diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-24 01:29:20 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-24 01:29:20 +0000 |
commit | 5778de6e6bfbc0439f49a245a75efa44e4f9a771 (patch) | |
tree | 7596aff0328ee022a23a9a0e84c28f94ee40ea30 /chrome_frame/urlmon_url_request.h | |
parent | b5be3f53d7af0037dbc634beb550752de56ad840 (diff) | |
download | chromium_src-5778de6e6bfbc0439f49a245a75efa44e4f9a771.zip chromium_src-5778de6e6bfbc0439f49a245a75efa44e4f9a771.tar.gz chromium_src-5778de6e6bfbc0439f49a245a75efa44e4f9a771.tar.bz2 |
Currently the host network stack in IE which uses Urlmon interfaces to initiate
and complete URL downloads requested by ChromeFrame, executes in the UI thread of IE.
While this works fine in most cases for large data sizes, the IE UI thread ends up being
busy pulling the data in our IBindStatusCallback::OnDataAvailable implementation. As a result
the browser hangs until all data is pulled out.
The fix is to handle Urlmon requests on a separate thread.
This fixes http://code.google.com/p/chromium/issues/detail?id=24007
Changes to plugin_url_request.cc/.h are to set the LF property on these files.
Bug=24007
Review URL: http://codereview.chromium.org/292035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29986 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/urlmon_url_request.h')
-rw-r--r-- | chrome_frame/urlmon_url_request.h | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/chrome_frame/urlmon_url_request.h b/chrome_frame/urlmon_url_request.h index 114ee6b..3c64243f 100644 --- a/chrome_frame/urlmon_url_request.h +++ b/chrome_frame/urlmon_url_request.h @@ -13,8 +13,10 @@ #include "base/lock.h" #include "base/platform_thread.h" +#include "base/thread.h" #include "base/scoped_comptr_win.h" #include "chrome_frame/plugin_url_request.h" +#include "chrome_frame/chrome_frame_delegate.h" #include "net/base/net_errors.h" #include "net/base/upload_data.h" @@ -87,8 +89,32 @@ END_SERVICE_MAP() parent_window_ = parent_window; } + // Needed to support PostTask. + static bool ImplementsThreadSafeReferenceCounting() { + return true; + } + + // URL requests are handled on this thread. + void set_worker_thread(base::Thread* worker_thread) { + worker_thread_ = worker_thread; + } + + void set_task_marshaller(TaskMarshaller* task_marshaller) { + task_marshaller_ = task_marshaller; + } + protected: + // The following functions issue and handle Urlmon requests on the dedicated + // Urlmon thread. + void StartAsync(); + void StopAsync(); + void ReadAsync(int bytes_to_read); + static const size_t kCopyChunkSize = 32 * 1024; + // URL requests are handled on this thread. + base::Thread* worker_thread_; + + TaskMarshaller* task_marshaller_; // A fake stream class to make it easier to copy received data using // IStream::CopyTo instead of allocating temporary buffers and keeping @@ -203,7 +229,9 @@ END_SERVICE_MAP() HRESULT StartAsyncDownload(); void EndRequest(); - + // Executes in the context of the UI thread and releases the outstanding + // reference to us. It also deletes the request mapping for this instance. + void EndRequestInternal(); int GetHttpResponseStatus() const; static net::Error HresultToNetError(HRESULT hr); @@ -221,7 +249,6 @@ END_SERVICE_MAP() uint64 post_data_len_; PlatformThreadId thread_; - bool is_request_started_; static int instance_count_; HWND parent_window_; DISALLOW_COPY_AND_ASSIGN(UrlmonUrlRequest); |