diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-12 22:06:14 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-12 22:06:14 +0000 |
commit | 051236f654c97138dd90a81c84e2b4dcaeb29918 (patch) | |
tree | ba065c97767f081d19f804d3a196b3ebba5d0609 /chrome_frame/urlmon_moniker_base.h | |
parent | 507c71074588f718be1808bc0ffe51f3733f6eb7 (diff) | |
download | chromium_src-051236f654c97138dd90a81c84e2b4dcaeb29918.zip chromium_src-051236f654c97138dd90a81c84e2b4dcaeb29918.tar.gz chromium_src-051236f654c97138dd90a81c84e2b4dcaeb29918.tar.bz2 |
Fix #1 for multiple request issue (both POST and GET) after activating the onhttpequiv approach.
There's a ton going on here. Brief summary: I'm introducing a caching layer for top level page requests that we then use again when switching the document from mshtml to cf.
Also in this change list:
* Removing the previous way of shifting the document moniker
over to the worker thread when a new chrome document is
created. Instead we use a request cache object.
* Refactoring the part of the Bho class that offered access
to it via TLS. This was needed for better testability but
also makes (imho) the separation clearer and will possibly
help in the future if we don't have a Bho object.
* Added a bit of logging that I'd prefer to keep in there until we're confident enough with onhttpequiv.
* Enabling two previously disabled tests (the ones I added for multiple requests)
* Adding several more unit tests for the new code.
Review URL: http://codereview.chromium.org/668187
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41495 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/urlmon_moniker_base.h')
-rw-r--r-- | chrome_frame/urlmon_moniker_base.h | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/chrome_frame/urlmon_moniker_base.h b/chrome_frame/urlmon_moniker_base.h new file mode 100644 index 0000000..6dd022c --- /dev/null +++ b/chrome_frame/urlmon_moniker_base.h @@ -0,0 +1,156 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_FRAME_URLMON_MONIKER_BASE_H_ +#define CHROME_FRAME_URLMON_MONIKER_BASE_H_ + +#include <atlbase.h> +#include <atlcom.h> + +// An implementation of IStream (minus IUnknown) that delegates to +// another source. Most of the methods contain a NOTREACHED() as the +// class is used by the ReadStreamCache class where we don't expect those +// calls under normal circumstances. +class DelegatingReadStream : public IStream { + public: + DelegatingReadStream() { + } + + ~DelegatingReadStream() { + } + + void SetDelegate(IStream* delegate) { + delegate_ = delegate; + } + + // ISequentialStream. + STDMETHOD(Read)(void* pv, ULONG cb, ULONG* read) { + return delegate_->Read(pv, cb, read); + } + + STDMETHOD(Write)(const void* pv, ULONG cb, ULONG* written) { + NOTREACHED(); + return delegate_->Write(pv, cb, written); + } + + // IStream. + STDMETHOD(Seek)(LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER* new_pos) { + NOTREACHED(); + return delegate_->Seek(move, origin, new_pos); + } + + STDMETHOD(SetSize)(ULARGE_INTEGER new_size) { + NOTREACHED(); + return delegate_->SetSize(new_size); + } + + STDMETHOD(CopyTo)(IStream* stream, ULARGE_INTEGER cb, ULARGE_INTEGER* read, + ULARGE_INTEGER* written) { + NOTREACHED(); + return delegate_->CopyTo(stream, cb, read, written); + } + + STDMETHOD(Commit)(DWORD commit_flags) { + NOTREACHED(); + return delegate_->Commit(commit_flags); + } + + STDMETHOD(Revert)() { + NOTREACHED(); + return delegate_->Revert(); + } + + STDMETHOD(LockRegion)(ULARGE_INTEGER offset, ULARGE_INTEGER cb, + DWORD lock_type) { + NOTREACHED(); + return delegate_->LockRegion(offset, cb, lock_type); + } + + STDMETHOD(UnlockRegion)(ULARGE_INTEGER offset, ULARGE_INTEGER cb, + DWORD lock_type) { + NOTREACHED(); + return delegate_->UnlockRegion(offset, cb, lock_type); + } + + STDMETHOD(Stat)(STATSTG* stat_stg, DWORD stat_flag) { + DCHECK(delegate_); + return delegate_->Stat(stat_stg, stat_flag); + } + + STDMETHOD(Clone)(IStream** stream) { + NOTREACHED(); + return delegate_->Clone(stream); + } + + protected: + ScopedComPtr<IStream> delegate_; +}; + +// A very basic implementation of IBinding that forwards all calls +// to a delegate. +class DelegatingBinding : public IBinding { + public: + DelegatingBinding() { + } + + ~DelegatingBinding() { + } + + IBinding* delegate() const { + return delegate_; + } + + void SetDelegate(IBinding* delegate) { + delegate_ = delegate; + } + + STDMETHOD(Abort)() { + DCHECK(delegate_); + if (!delegate_) + return S_OK; + return delegate_->Abort(); + } + + STDMETHOD(Suspend)() { + DCHECK(delegate_); + if (!delegate_) + return E_FAIL; + return delegate_->Suspend(); + } + + STDMETHOD(Resume)() { + DCHECK(delegate_); + if (!delegate_) + return E_FAIL; + return delegate_->Resume(); + } + + STDMETHOD(SetPriority)(LONG priority) { + DCHECK(delegate_); + if (!delegate_) + return E_FAIL; + return delegate_->SetPriority(priority); + } + + STDMETHOD(GetPriority)(LONG* priority) { + DCHECK(delegate_); + if (!delegate_) + return E_FAIL; + return delegate_->GetPriority(priority); + } + + STDMETHOD(GetBindResult)(CLSID* protocol, DWORD* result_code, + LPOLESTR* result, DWORD* reserved) { + DCHECK(delegate_); + if (!delegate_) + return E_FAIL; + return delegate_->GetBindResult(protocol, result_code, result, reserved); + } + + protected: + ScopedComPtr<IBinding> delegate_; +}; + +#endif // CHROME_FRAME_URLMON_MONIKER_BASE_H_ + |