summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome_frame/urlmon_bind_status_callback.cc15
-rw-r--r--chrome_frame/urlmon_bind_status_callback.h2
2 files changed, 8 insertions, 9 deletions
diff --git a/chrome_frame/urlmon_bind_status_callback.cc b/chrome_frame/urlmon_bind_status_callback.cc
index cf920c2..68cf175 100644
--- a/chrome_frame/urlmon_bind_status_callback.cc
+++ b/chrome_frame/urlmon_bind_status_callback.cc
@@ -112,10 +112,8 @@ HRESULT SniffData::ReadIntoCache(IStream* stream, bool force_determination) {
break;
}
- if (force_determination || (size() >= kMaxSniffSize)) {
- DetermineRendererType();
- }
-
+ bool last_chance = force_determination || (size() >= kMaxSniffSize);
+ DetermineRendererType(last_chance);
return hr;
}
@@ -142,13 +140,14 @@ HRESULT SniffData::DrainCache(IBindStatusCallback* bscb, DWORD bscf,
}
// Scan the buffer or OptIn URL list and decide if the renderer is
-// to be switched
-void SniffData::DetermineRendererType() {
+// to be switched. Last chance means there's no more data.
+void SniffData::DetermineRendererType(bool last_chance) {
if (is_undetermined()) {
+ if (last_chance)
+ renderer_type_ = OTHER;
if (IsOptInUrl(url_.c_str())) {
renderer_type_ = CHROME;
} else {
- renderer_type_ = OTHER;
if (is_cache_valid() && cache_) {
HGLOBAL memory = NULL;
GetHGlobalFromStream(cache_, &memory);
@@ -284,7 +283,7 @@ STDMETHODIMP BSCBStorageBind::OnStopBinding(HRESULT hresult, LPCWSTR error) {
HRESULT BSCBStorageBind::MayPlayBack(DWORD flags) {
// Force renderer type determination if not already done since
// we want to play back data now.
- data_sniffer_.DetermineRendererType();
+ data_sniffer_.DetermineRendererType(true);
DCHECK(!data_sniffer_.is_undetermined());
HRESULT hr = S_OK;
diff --git a/chrome_frame/urlmon_bind_status_callback.h b/chrome_frame/urlmon_bind_status_callback.h
index c6b4ba7..2475ba1 100644
--- a/chrome_frame/urlmon_bind_status_callback.h
+++ b/chrome_frame/urlmon_bind_status_callback.h
@@ -55,7 +55,7 @@ class SniffData {
HRESULT ReadIntoCache(IStream* stream, bool force_determination);
HRESULT DrainCache(IBindStatusCallback* bscb, DWORD bscf,
CLIPFORMAT clip_format);
- void DetermineRendererType();
+ void DetermineRendererType(bool last_chance);
bool is_undetermined() const {
return (UNDETERMINED == renderer_type_);