diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-23 04:33:52 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-23 04:33:52 +0000 |
commit | 458e9521995681381912ece90eb2a8ea210ae07d (patch) | |
tree | d5eeabdee1104f65f42990bbd7edc238a57480d5 /chrome_frame | |
parent | 1822c9949f19195ca0000f0be929a5398a7c24e6 (diff) | |
download | chromium_src-458e9521995681381912ece90eb2a8ea210ae07d.zip chromium_src-458e9521995681381912ece90eb2a8ea210ae07d.tar.gz chromium_src-458e9521995681381912ece90eb2a8ea210ae07d.tar.bz2 |
Add methods to base::Thread to allow Windows consumers to ask for COM to be intialized on the Thread.
This makes one functional change: when COM is initialized in STA mode, the Thread is forced to use a TYPE_UI message loop. Most of the modified consumers here didn't previously do that, but after discussion with cpu and siggi, it seems safest, even though it's more heavyweight.
BUG=none
TEST=none
Review URL: https://codereview.chromium.org/11048029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163503 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/buggy_bho_handling.cc | 3 | ||||
-rw-r--r-- | chrome_frame/urlmon_url_request.cc | 21 | ||||
-rw-r--r-- | chrome_frame/urlmon_url_request.h | 22 | ||||
-rw-r--r-- | chrome_frame/utils.h | 28 |
4 files changed, 7 insertions, 67 deletions
diff --git a/chrome_frame/buggy_bho_handling.cc b/chrome_frame/buggy_bho_handling.cc index aab4e69..9d00528 100644 --- a/chrome_frame/buggy_bho_handling.cc +++ b/chrome_frame/buggy_bho_handling.cc @@ -4,10 +4,11 @@ #include "chrome_frame/buggy_bho_handling.h" +#include <algorithm> + #include "base/logging.h" #include "base/process_util.h" #include "base/win/scoped_comptr.h" - #include "chrome_frame/exception_barrier.h" #include "chrome_frame/function_stub.h" #include "chrome_frame/utils.h" diff --git a/chrome_frame/urlmon_url_request.cc b/chrome_frame/urlmon_url_request.cc index 535debb..6d33e551 100644 --- a/chrome_frame/urlmon_url_request.cc +++ b/chrome_frame/urlmon_url_request.cc @@ -15,6 +15,7 @@ #include "base/string_number_conversions.h" #include "base/stringprintf.h" #include "base/threading/platform_thread.h" +#include "base/threading/thread.h" #include "base/utf_string_conversions.h" #include "chrome/common/automation_messages.h" #include "chrome_frame/bind_context_info.h" @@ -1401,8 +1402,8 @@ UrlmonUrlRequestManager::UrlmonUrlRequestManager() privileged_mode_(false), container_(NULL), background_worker_thread_enabled_(true) { - background_thread_.reset(new ResourceFetcherThread( - "cf_iexplore_background_thread")); + background_thread_.reset(new base::Thread("cf_iexplore_background_thread")); + background_thread_->init_com_with_mta(false); background_worker_thread_enabled_ = GetConfigBool(true, kUseBackgroundThreadForSubResources); if (background_worker_thread_enabled_) { @@ -1445,19 +1446,3 @@ void UrlmonUrlRequestManager::AddPrivacyDataForUrl( 0); } } - -UrlmonUrlRequestManager::ResourceFetcherThread::ResourceFetcherThread( - const char* name) : base::Thread(name) { -} - -UrlmonUrlRequestManager::ResourceFetcherThread::~ResourceFetcherThread() { - Stop(); -} - -void UrlmonUrlRequestManager::ResourceFetcherThread::Init() { - com_initializer_.reset(new base::win::ScopedCOMInitializer()); -} - -void UrlmonUrlRequestManager::ResourceFetcherThread::CleanUp() { - com_initializer_.reset(); -} diff --git a/chrome_frame/urlmon_url_request.h b/chrome_frame/urlmon_url_request.h index 94027ff..3ec3a9e 100644 --- a/chrome_frame/urlmon_url_request.h +++ b/chrome_frame/urlmon_url_request.h @@ -11,15 +11,12 @@ #include <map> #include <string> -#include "base/threading/thread.h" #include "chrome_frame/plugin_url_request.h" #include "chrome_frame/urlmon_moniker.h" #include "chrome_frame/utils.h" namespace base { -namespace win { -class ScopedCOMInitializer; -} +class Thread; } class UrlmonUrlRequest; @@ -28,21 +25,6 @@ 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(); - - private: - scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; - - DISALLOW_COPY_AND_ASSIGN(ResourceFetcherThread); - }; - // Contains the privacy information for all requests issued by this instance. struct PrivacyInfo { public: @@ -151,7 +133,7 @@ class UrlmonUrlRequestManager base::Lock* request_map_lock); scoped_refptr<UrlmonUrlRequest> pending_request_; - scoped_ptr<ResourceFetcherThread> background_thread_; + scoped_ptr<base::Thread> background_thread_; bool stopping_; diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h index 389a8f5..2204571 100644 --- a/chrome_frame/utils.h +++ b/chrome_frame/utils.h @@ -16,8 +16,6 @@ #include "base/logging.h" #include "base/metrics/histogram.h" #include "base/string16.h" -#include "base/threading/thread.h" -#include "base/win/scoped_com_initializer.h" #include "base/win/scoped_comptr.h" #include "googleurl/src/gurl.h" #include "ui/gfx/rect.h" @@ -396,32 +394,6 @@ STDMETHODIMP QueryInterfaceIfDelegateSupports(void* obj, REFIID iid, #define COM_INTERFACE_BLIND_DELEGATE() \ COM_INTERFACE_ENTRY_FUNC_BLIND(0, CheckOutgoingInterface<_ComMapClass>) -// Thread that enters STA and has a UI message loop. -class STAThread : public base::Thread { - public: - explicit STAThread(const char *name) : Thread(name) {} - virtual ~STAThread() { - Stop(); - } - - bool Start() { - return StartWithOptions(Options(MessageLoop::TYPE_UI, 0)); - } - - private: - virtual void Init() OVERRIDE { - com_initializer_.reset(new base::win::ScopedCOMInitializer()); - } - - virtual void CleanUp() OVERRIDE { - com_initializer_.reset(); - } - - scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; - - DISALLOW_COPY_AND_ASSIGN(STAThread); -}; - std::wstring GuidToString(const GUID& guid); // The urls retrieved from the IMoniker interface don't contain the anchor |