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/chrome_frame_delegate.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/chrome_frame_delegate.h')
-rw-r--r-- | chrome_frame/chrome_frame_delegate.h | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/chrome_frame/chrome_frame_delegate.h b/chrome_frame/chrome_frame_delegate.h index e11f099..bbdc99e 100644 --- a/chrome_frame/chrome_frame_delegate.h +++ b/chrome_frame/chrome_frame_delegate.h @@ -5,6 +5,9 @@ #ifndef CHROME_FRAME_CHROME_FRAME_DELEGATE_H_ #define CHROME_FRAME_CHROME_FRAME_DELEGATE_H_ +#include <atlbase.h> +#include <atlwin.h> + #include "chrome/test/automation/automation_messages.h" #include "ipc/ipc_message.h" @@ -12,7 +15,6 @@ // implementations. class ChromeFrameDelegate { public: - typedef HWND WindowType; virtual WindowType GetWindow() const = 0; @@ -103,4 +105,45 @@ class ChromeFrameDelegateImpl : public ChromeFrameDelegate { virtual void OnGoToHistoryEntryOffset(int tab_handle, int offset) {} }; +// This interface enables tasks to be marshalled to desired threads. +class TaskMarshaller { + public: + virtual void PostTask(const tracked_objects::Location& from_here, + Task* task) = 0; +}; + +// T is expected to be something CWindowImpl derived, or at least to have +// PostMessage(UINT, WPARAM) method. Do not forget to CHAIN_MSG_MAP +template <class T> class TaskMarshallerThroughWindowsMessages + : public TaskMarshaller { + public: + virtual void PostTask(const tracked_objects::Location& from_here, + Task* task) { + task->SetBirthPlace(from_here); + T* this_ptr = static_cast<T*>(this); + if (this_ptr->IsWindow()) { + this_ptr->AddRef(); + this_ptr->PostMessage(MSG_EXECUTE_TASK, reinterpret_cast<WPARAM>(task)); + } else { + DLOG(INFO) << "Dropping MSG_EXECUTE_TASK message for destroyed window."; + } + } + + BEGIN_MSG_MAP(PostMessageMarshaller) + MESSAGE_HANDLER(MSG_EXECUTE_TASK, ExecuteTask) + END_MSG_MAP() + + private: + enum { MSG_EXECUTE_TASK = WM_APP + 6 }; + inline LRESULT ExecuteTask(UINT, WPARAM wparam, LPARAM, + BOOL& handled) { // NOLINT + Task* task = reinterpret_cast<Task*>(wparam); + task->Run(); + delete task; + T* this_ptr = static_cast<T*>(this); + this_ptr->Release(); + return 0; + } +}; + #endif // CHROME_FRAME_CHROME_FRAME_DELEGATE_H_ |