diff options
author | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 22:37:40 +0000 |
---|---|---|
committer | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 22:37:40 +0000 |
commit | 37a3a4bf36aa3a07ed4982c815d427141b2aa9f8 (patch) | |
tree | 57a36ec7d0dc9303bcb08d7bc0d329dda0bd0fc2 /chrome_frame | |
parent | 4cc5e954e5a7b0c60f88b5461fd953d377ffe5f9 (diff) | |
download | chromium_src-37a3a4bf36aa3a07ed4982c815d427141b2aa9f8.zip chromium_src-37a3a4bf36aa3a07ed4982c815d427141b2aa9f8.tar.gz chromium_src-37a3a4bf36aa3a07ed4982c815d427141b2aa9f8.tar.bz2 |
Sniff data for the chrome meta tag as in comes in.
Doing this allows us to make an determination of the
renderer type at the right time in case of the server
breaking connection unexpectedly without proper end
of data notification.
TEST=automated tests using sub_frame1.html
BUG=none
Review URL: http://codereview.chromium.org/1594031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44567 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/urlmon_bind_status_callback.cc | 15 | ||||
-rw-r--r-- | chrome_frame/urlmon_bind_status_callback.h | 2 |
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_); |