зеркало из https://github.com/mozilla/gecko-dev.git
Bug 813438 - Part 2: Remove the I/O service content sniffer cache; r=bzbarsky
This commit is contained in:
Родитель
e5022e988f
Коммит
6c1c6015f2
|
@ -13,7 +13,6 @@
|
|||
#include "nsIHttpChannel.h"
|
||||
#include "nsIChannelEventSink.h"
|
||||
#include "nsIStreamConverterService.h"
|
||||
#include "nsIContentSniffer.h"
|
||||
#include "nsChannelClassifier.h"
|
||||
#include "nsAsyncRedirectVerifyHelper.h"
|
||||
|
||||
|
@ -673,17 +672,10 @@ CallTypeSniffers(void *aClosure, const uint8_t *aData, uint32_t aCount)
|
|||
{
|
||||
nsIChannel *chan = static_cast<nsIChannel*>(aClosure);
|
||||
|
||||
const nsCOMArray<nsIContentSniffer>& sniffers =
|
||||
gIOService->GetContentSniffers();
|
||||
uint32_t length = sniffers.Count();
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
nsAutoCString newType;
|
||||
nsresult rv =
|
||||
sniffers[i]->GetMIMETypeFromContent(chan, aData, aCount, newType);
|
||||
if (NS_SUCCEEDED(rv) && !newType.IsEmpty()) {
|
||||
chan->SetContentType(newType);
|
||||
break;
|
||||
}
|
||||
nsAutoCString newType;
|
||||
NS_SniffContent(NS_CONTENT_SNIFFER_CATEGORY, chan, aData, aCount, newType);
|
||||
if (!newType.IsEmpty()) {
|
||||
chan->SetContentType(newType);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -719,8 +711,7 @@ nsBaseChannel::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
|||
}
|
||||
|
||||
// Now, the general type sniffers. Skip this if we have none.
|
||||
if ((mLoadFlags & LOAD_CALL_CONTENT_SNIFFERS) &&
|
||||
gIOService->GetContentSniffers().Count() != 0)
|
||||
if (mLoadFlags & LOAD_CALL_CONTENT_SNIFFERS)
|
||||
mPump->PeekStream(CallTypeSniffers, static_cast<nsIChannel*>(this));
|
||||
|
||||
SUSPEND_PUMP_FOR_SCOPE();
|
||||
|
|
|
@ -153,7 +153,6 @@ nsIOService::nsIOService()
|
|||
, mShutdown(false)
|
||||
, mNetworkLinkServiceInitialized(false)
|
||||
, mChannelEventSinks(NS_CHANNEL_EVENT_SINK_CATEGORY)
|
||||
, mContentSniffers(NS_CONTENT_SNIFFER_CATEGORY)
|
||||
, mAutoDialEnabled(false)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -71,11 +71,6 @@ public:
|
|||
uint32_t flags,
|
||||
nsAsyncRedirectVerifyHelper *helper);
|
||||
|
||||
// Gets the array of registered content sniffers
|
||||
const nsCOMArray<nsIContentSniffer>& GetContentSniffers() {
|
||||
return mContentSniffers.GetEntries();
|
||||
}
|
||||
|
||||
bool IsOffline() { return mOffline; }
|
||||
bool IsLinkUp();
|
||||
|
||||
|
@ -134,7 +129,6 @@ private:
|
|||
|
||||
// cached categories
|
||||
nsCategoryCache<nsIChannelEventSink> mChannelEventSinks;
|
||||
nsCategoryCache<nsIContentSniffer> mContentSniffers;
|
||||
|
||||
nsTArray<int32_t> mRestrictedPortList;
|
||||
|
||||
|
|
|
@ -866,17 +866,10 @@ CallTypeSniffers(void *aClosure, const uint8_t *aData, uint32_t aCount)
|
|||
{
|
||||
nsIChannel *chan = static_cast<nsIChannel*>(aClosure);
|
||||
|
||||
const nsCOMArray<nsIContentSniffer>& sniffers =
|
||||
gIOService->GetContentSniffers();
|
||||
uint32_t length = sniffers.Count();
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
nsAutoCString newType;
|
||||
nsresult rv =
|
||||
sniffers[i]->GetMIMETypeFromContent(chan, aData, aCount, newType);
|
||||
if (NS_SUCCEEDED(rv) && !newType.IsEmpty()) {
|
||||
chan->SetContentType(newType);
|
||||
break;
|
||||
}
|
||||
nsAutoCString newType;
|
||||
NS_SniffContent(NS_CONTENT_SNIFFER_CATEGORY, chan, aData, aCount, newType);
|
||||
if (!newType.IsEmpty()) {
|
||||
chan->SetContentType(newType);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -886,8 +879,7 @@ nsHttpChannel::CallOnStartRequest()
|
|||
mTracingEnabled = false;
|
||||
|
||||
// Allow consumers to override our content type
|
||||
if ((mLoadFlags & LOAD_CALL_CONTENT_SNIFFERS) &&
|
||||
gIOService->GetContentSniffers().Count() != 0) {
|
||||
if (mLoadFlags & LOAD_CALL_CONTENT_SNIFFERS) {
|
||||
// NOTE: We can have both a txn pump and a cache pump when the cache
|
||||
// content is partial. In that case, we need to read from the cache,
|
||||
// because that's the one that has the initial contents. If that fails
|
||||
|
|
Загрузка…
Ссылка в новой задаче