diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-16 01:38:48 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-16 01:38:48 +0000 |
commit | de5bc35e8c0835ba223c3ffcda1099e50f708274 (patch) | |
tree | 0f86654a822ed93e8bfecc7097233b2ff1d0d37a /chrome_frame | |
parent | 6ee88534895ff56a131400acfd2a837824ef1ead (diff) | |
download | chromium_src-de5bc35e8c0835ba223c3ffcda1099e50f708274.zip chromium_src-de5bc35e8c0835ba223c3ffcda1099e50f708274.tar.gz chromium_src-de5bc35e8c0835ba223c3ffcda1099e50f708274.tar.bz2 |
With the ChromeFrame moniker patch on, the data cache maintained to indicate whether we should switch to Chrome, was not being
drained correctly to the delegate, resulting in the delegate continuing to wait for more data when there was none. This caused
sites like go/wave to not redirect correctly to CF.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=41365
Bug=41365
Review URL: http://codereview.chromium.org/1637017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44735 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/bind_context_info.h | 2 | ||||
-rw-r--r-- | chrome_frame/test/urlmon_moniker_unittest.cc | 4 | ||||
-rw-r--r-- | chrome_frame/urlmon_bind_status_callback.cc | 13 | ||||
-rw-r--r-- | chrome_frame/urlmon_bind_status_callback.h | 10 |
4 files changed, 16 insertions, 13 deletions
diff --git a/chrome_frame/bind_context_info.h b/chrome_frame/bind_context_info.h index e66d450..5e0186b 100644 --- a/chrome_frame/bind_context_info.h +++ b/chrome_frame/bind_context_info.h @@ -51,8 +51,6 @@ class BindContextInfo : public IUnknown, public CComObjectRoot { return cache_; } - void set_cache(IStream* cache); - private: ScopedComPtr<IStream> cache_; bool no_cache_; diff --git a/chrome_frame/test/urlmon_moniker_unittest.cc b/chrome_frame/test/urlmon_moniker_unittest.cc index f50bd86..ba1b132 100644 --- a/chrome_frame/test/urlmon_moniker_unittest.cc +++ b/chrome_frame/test/urlmon_moniker_unittest.cc @@ -74,7 +74,7 @@ TEST_F(MonikerPatchTest, CacheStream) { // Test 2: Read from initialized cache CComObjectStackEx<CacheStream> cache_stream2; - cache_stream2.Initialize(data, sizeof(data)); + cache_stream2.Initialize(data, sizeof(data), false); EXPECT_HRESULT_SUCCEEDED(cache_stream2.Read(ret, sizeof(ret), &read)); EXPECT_EQ(sizeof(data), read); EXPECT_EQ(std::string(data), std::string(ret)); @@ -112,7 +112,7 @@ TEST_F(MonikerPatchTest, BSCBFeedData) { Return(S_OK))); EXPECT_HRESULT_SUCCEEDED(CacheStream::BSCBFeedData(&mock, data, size, cf, - flags)); + flags, false)); EXPECT_HRESULT_SUCCEEDED(ret1); EXPECT_STREQ(data, read_buffer1); diff --git a/chrome_frame/urlmon_bind_status_callback.cc b/chrome_frame/urlmon_bind_status_callback.cc index 6f85210..c870f7ad 100644 --- a/chrome_frame/urlmon_bind_status_callback.cc +++ b/chrome_frame/urlmon_bind_status_callback.cc @@ -20,7 +20,7 @@ // CacheStream instance. HRESULT CacheStream::BSCBFeedData(IBindStatusCallback* bscb, const char* data, size_t size, CLIPFORMAT clip_format, - size_t flags) { + size_t flags, bool eof) { if (!bscb) { NOTREACHED() << "invalid IBindStatusCallback"; return E_INVALIDARG; @@ -36,7 +36,7 @@ HRESULT CacheStream::BSCBFeedData(IBindStatusCallback* bscb, const char* data, } cache_stream->AddRef(); - cache_stream->Initialize(data, size); + cache_stream->Initialize(data, size, eof); FORMATETC format_etc = { clip_format, NULL, DVASPECT_CONTENT, -1, TYMED_ISTREAM }; @@ -50,10 +50,11 @@ HRESULT CacheStream::BSCBFeedData(IBindStatusCallback* bscb, const char* data, return hr; } -void CacheStream::Initialize(const char* cache, size_t size) { +void CacheStream::Initialize(const char* cache, size_t size, bool eof) { cache_ = cache; size_ = size; position_ = 0; + eof_ = eof; } // Read is the only call that we expect. Return E_PENDING if there @@ -64,7 +65,7 @@ STDMETHODIMP CacheStream::Read(void* pv, ULONG cb, ULONG* read) { return E_INVALIDARG; // Default to E_PENDING to signal that this is a partial data. - HRESULT hr = E_PENDING; + HRESULT hr = eof_ ? S_FALSE : E_PENDING; if (position_ < size_) { *read = std::min(size_ - position_, size_t(cb)); memcpy(pv, cache_ + position_, *read); @@ -114,6 +115,7 @@ HRESULT SniffData::ReadIntoCache(IStream* stream, bool force_determination) { } bool last_chance = force_determination || (size() >= kMaxSniffSize); + eof_ = force_determination; DetermineRendererType(last_chance); return hr; } @@ -131,7 +133,8 @@ HRESULT SniffData::DrainCache(IBindStatusCallback* bscb, DWORD bscf, HRESULT hr = GetHGlobalFromStream(cache_, &memory); if (SUCCEEDED(hr) && memory) { char* buffer = reinterpret_cast<char*>(GlobalLock(memory)); - hr = CacheStream::BSCBFeedData(bscb, buffer, size_, clip_format, bscf); + hr = CacheStream::BSCBFeedData(bscb, buffer, size_, clip_format, bscf, + eof_); GlobalUnlock(memory); } diff --git a/chrome_frame/urlmon_bind_status_callback.h b/chrome_frame/urlmon_bind_status_callback.h index 8f33252..0ecf51f 100644 --- a/chrome_frame/urlmon_bind_status_callback.h +++ b/chrome_frame/urlmon_bind_status_callback.h @@ -21,12 +21,12 @@ class CacheStream : public CComObjectRoot, public StreamImpl { COM_INTERFACE_ENTRY(ISequentialStream) END_COM_MAP() - CacheStream() : cache_(NULL), size_(0), position_(0) { + CacheStream() : cache_(NULL), size_(0), position_(0), eof_(false) { } - void Initialize(const char* cache, size_t size); + void Initialize(const char* cache, size_t size, bool eof); static HRESULT BSCBFeedData(IBindStatusCallback* bscb, const char* data, size_t size, CLIPFORMAT clip_format, - size_t flags); + size_t flags, bool eof); // IStream overrides STDMETHOD(Read)(void* pv, ULONG cb, ULONG* read); @@ -35,6 +35,7 @@ class CacheStream : public CComObjectRoot, public StreamImpl { const char* cache_; size_t size_; size_t position_; + bool eof_; private: DISALLOW_COPY_AND_ASSIGN(CacheStream); @@ -43,7 +44,7 @@ class CacheStream : public CComObjectRoot, public StreamImpl { // Utility class for data sniffing class SniffData { public: - SniffData() : renderer_type_(OTHER), size_(0) {} + SniffData() : renderer_type_(OTHER), size_(0), eof_(false) {} enum RendererType { UNDETERMINED, @@ -82,6 +83,7 @@ class SniffData { size_t size_; static const size_t kMaxSniffSize = 2 * 1024; + bool eof_; private: DISALLOW_COPY_AND_ASSIGN(SniffData); |