diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-05 20:59:38 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-05 20:59:38 +0000 |
commit | b0938a4592d2f535687a8ee97d5f81ca96db2b7b (patch) | |
tree | 894e7be57d2efec0535389fa7d7c4e71c4c0daa4 /chrome_frame/urlmon_url_request.h | |
parent | 8c6844fc33ef1d2fc49b57e4b2187c1855d271cb (diff) | |
download | chromium_src-b0938a4592d2f535687a8ee97d5f81ca96db2b7b.zip chromium_src-b0938a4592d2f535687a8ee97d5f81ca96db2b7b.tar.gz chromium_src-b0938a4592d2f535687a8ee97d5f81ca96db2b7b.tar.bz2 |
Handle UrlRequests in ChromeFrame for resource types except MAIN_FRAME and SUB_FRAME in a background worker thread.
We have a new request map in ChromeFrame to keep track of these requests. We synchronize access to this map as it is accessed from multiple threads.
This is an attempt to verify if the performance issues seen on CF are related to handling all HTTP requests on the
IE UI thread.
This is configurable via a registry DWORD value "BackgroundHTTPWorkerThread" under HKCU\Software\Google\ChromeFrame
Defaults to true.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=98510
BUG=98510
Review URL: http://codereview.chromium.org/8115018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104168 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/urlmon_url_request.h')
-rw-r--r-- | chrome_frame/urlmon_url_request.h | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/chrome_frame/urlmon_url_request.h b/chrome_frame/urlmon_url_request.h index 496c33d..8967d9f 100644 --- a/chrome_frame/urlmon_url_request.h +++ b/chrome_frame/urlmon_url_request.h @@ -22,6 +22,16 @@ class UrlmonUrlRequestManager : public PluginUrlRequestManager, public PluginUrlRequestDelegate { public: + // Sub resources on the pages in chrome frame are fetched on this thread. + class ResourceFetcherThread : public base::Thread { + public: + explicit ResourceFetcherThread(const char* name); + virtual ~ResourceFetcherThread(); + + virtual void Init(); + virtual void CleanUp(); + }; + // Contains the privacy information for all requests issued by this instance. struct PrivacyInfo { public: @@ -74,7 +84,10 @@ class UrlmonUrlRequestManager private: friend class MessageLoop; friend struct RunnableMethodTraits<UrlmonUrlRequestManager>; + + // This method is needed to support PostTask on this object. static bool ImplementsThreadSafeReferenceCounting() { return true; } + void AddRef() {} void Release() {} @@ -109,14 +122,39 @@ class UrlmonUrlRequestManager void BindTerminated(IMoniker* moniker, IBindCtx* bind_ctx, IStream* post_data, const char* request_headers); + // Helper function to initiate a download request in the host. + void DownloadRequestInHostHelper(UrlmonUrlRequest* request); + // Map for (request_id <-> UrlmonUrlRequest) typedef std::map<int, scoped_refptr<UrlmonUrlRequest> > RequestMap; RequestMap request_map_; - scoped_refptr<UrlmonUrlRequest> LookupRequest(int request_id); + RequestMap background_request_map_; + + // The caller is responsible for acquiring any locks needed to access the + // request map. + scoped_refptr<UrlmonUrlRequest> LookupRequest(int request_id, + RequestMap* request_map); + // The background_request_map_ is referenced from multiple threads. Lock to + // synchronize access. + base::Lock background_resource_map_lock_; + + // Helper function to stop all requests in the request map. + void StopAllRequestsHelper(RequestMap* request_map, + base::Lock* request_map_lock); + // Helper function for initiating a new IE request. + void StartRequestHelper(int request_id, + const AutomationURLRequest& request_info, + RequestMap* request_map, + base::Lock* request_map_lock); + scoped_refptr<UrlmonUrlRequest> pending_request_; + scoped_ptr<ResourceFetcherThread> background_thread_; bool stopping_; - int calling_delegate_; // re-entrancy protection (debug only check) + + // Controls whether we download subresources on the page in a background + // worker thread. + bool background_worker_thread_enabled_; PrivacyInfo privacy_info_; // The window to be used to fire notifications on. |