summaryrefslogtreecommitdiffstats
path: root/chrome_frame/urlmon_url_request.h
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 22:06:14 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 22:06:14 +0000
commit051236f654c97138dd90a81c84e2b4dcaeb29918 (patch)
treeba065c97767f081d19f804d3a196b3ebba5d0609 /chrome_frame/urlmon_url_request.h
parent507c71074588f718be1808bc0ffe51f3733f6eb7 (diff)
downloadchromium_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_url_request.h')
-rw-r--r--chrome_frame/urlmon_url_request.h41
1 files changed, 27 insertions, 14 deletions
diff --git a/chrome_frame/urlmon_url_request.h b/chrome_frame/urlmon_url_request.h
index 6fbc147..5382314 100644
--- a/chrome_frame/urlmon_url_request.h
+++ b/chrome_frame/urlmon_url_request.h
@@ -8,6 +8,7 @@
#include <urlmon.h>
#include <atlbase.h>
#include <atlcom.h>
+#include <map>
#include <string>
#include "base/lock.h"
@@ -15,10 +16,32 @@
#include "base/thread.h"
#include "base/waitable_event.h"
#include "chrome_frame/plugin_url_request.h"
+#include "chrome_frame/urlmon_moniker.h"
#include "chrome_frame/utils.h"
class UrlmonUrlRequest;
+class RequestDataForUrl {
+ public:
+ RequestDataForUrl(RequestData* data, const std::wstring& url)
+ : request_data_(data), url_(url) {
+ }
+ ~RequestDataForUrl() {
+ }
+
+ const std::wstring& url() const {
+ return url_;
+ }
+
+ RequestData* request_data() const {
+ return request_data_;
+ }
+
+ protected:
+ scoped_refptr<RequestData> request_data_;
+ std::wstring url_;
+};
+
class UrlmonUrlRequestManager
: public PluginUrlRequestManager,
public PluginUrlRequestDelegate {
@@ -26,22 +49,12 @@ class UrlmonUrlRequestManager
UrlmonUrlRequestManager();
~UrlmonUrlRequestManager();
- // Use specific moniker and bind context when Chrome request this url.
+ // Use cached data when Chrome request this url.
// Used from ChromeActiveDocument's implementation of IPersistMoniker::Load().
- void UseMonikerForUrl(IMoniker* moniker, IBindCtx* bind_ctx,
- const std::wstring& url);
+ void UseRequestDataForUrl(RequestData* data, const std::wstring& url);
void StealMonikerFromRequest(int request_id, IMoniker** moniker);
void SetErrorDialogsParentWindow(HWND window);
private:
- struct MonikerForUrl {
- MonikerForUrl() {
- memset(&bind_opts, 0, sizeof(bind_opts));
- }
- ScopedComPtr<IMoniker> moniker;
- BIND_OPTS bind_opts;
- std::wstring url;
- };
-
friend class MessageLoop;
friend struct RunnableMethodTraits<UrlmonUrlRequestManager>;
static bool ImplementsThreadSafeReferenceCounting() { return true; }
@@ -68,7 +81,7 @@ class UrlmonUrlRequestManager
// Methods executed in worker thread.
void StartRequestWorker(int request_id,
const IPC::AutomationURLRequest& request_info,
- MonikerForUrl* moniker_for_url);
+ RequestDataForUrl* use_request);
void ReadRequestWorker(int request_id, int bytes_to_read);
void EndRequestWorker(int request_id);
void StopAllWorker();
@@ -80,7 +93,7 @@ class UrlmonUrlRequestManager
RequestMap request_map_;
scoped_refptr<UrlmonUrlRequest> LookupRequest(int request_id);
- scoped_ptr<MonikerForUrl> moniker_for_url_;
+ scoped_ptr<RequestDataForUrl> request_data_for_url_;
STAThread worker_thread_;
base::WaitableEvent map_empty_;
bool stopping_;