Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: chrome_frame/urlmon_url_request.cc

Issue 11048029: Allow Thread to initialize COM for Windows consumers who need it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/urlmon_url_request.h ('k') | chrome_frame/utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome_frame/urlmon_url_request.h" 5 #include "chrome_frame/urlmon_url_request.h"
6 6
7 #include <urlmon.h> 7 #include <urlmon.h>
8 #include <wininet.h> 8 #include <wininet.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
16 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
17 #include "base/threading/platform_thread.h" 17 #include "base/threading/platform_thread.h"
18 #include "base/threading/thread.h"
18 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
19 #include "chrome/common/automation_messages.h" 20 #include "chrome/common/automation_messages.h"
20 #include "chrome_frame/bind_context_info.h" 21 #include "chrome_frame/bind_context_info.h"
21 #include "chrome_frame/chrome_frame_activex_base.h" 22 #include "chrome_frame/chrome_frame_activex_base.h"
22 #include "chrome_frame/extra_system_apis.h" 23 #include "chrome_frame/extra_system_apis.h"
23 #include "chrome_frame/html_utils.h" 24 #include "chrome_frame/html_utils.h"
24 #include "chrome_frame/urlmon_upload_data_stream.h" 25 #include "chrome_frame/urlmon_upload_data_stream.h"
25 #include "chrome_frame/urlmon_url_request_private.h" 26 #include "chrome_frame/urlmon_url_request_private.h"
26 #include "chrome_frame/utils.h" 27 #include "chrome_frame/utils.h"
27 #include "net/base/load_flags.h" 28 #include "net/base/load_flags.h"
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 if (request_map->end() != it) 1395 if (request_map->end() != it)
1395 return it->second; 1396 return it->second;
1396 return NULL; 1397 return NULL;
1397 } 1398 }
1398 1399
1399 UrlmonUrlRequestManager::UrlmonUrlRequestManager() 1400 UrlmonUrlRequestManager::UrlmonUrlRequestManager()
1400 : stopping_(false), notification_window_(NULL), 1401 : stopping_(false), notification_window_(NULL),
1401 privileged_mode_(false), 1402 privileged_mode_(false),
1402 container_(NULL), 1403 container_(NULL),
1403 background_worker_thread_enabled_(true) { 1404 background_worker_thread_enabled_(true) {
1404 background_thread_.reset(new ResourceFetcherThread( 1405 background_thread_.reset(new base::Thread("cf_iexplore_background_thread"));
1405 "cf_iexplore_background_thread")); 1406 background_thread_->init_com_with_mta(false);
1406 background_worker_thread_enabled_ = 1407 background_worker_thread_enabled_ =
1407 GetConfigBool(true, kUseBackgroundThreadForSubResources); 1408 GetConfigBool(true, kUseBackgroundThreadForSubResources);
1408 if (background_worker_thread_enabled_) { 1409 if (background_worker_thread_enabled_) {
1409 base::Thread::Options options; 1410 base::Thread::Options options;
1410 options.message_loop_type = MessageLoop::TYPE_UI; 1411 options.message_loop_type = MessageLoop::TYPE_UI;
1411 background_thread_->StartWithOptions(options); 1412 background_thread_->StartWithOptions(options);
1412 } 1413 }
1413 } 1414 }
1414 1415
1415 UrlmonUrlRequestManager::~UrlmonUrlRequestManager() { 1416 UrlmonUrlRequestManager::~UrlmonUrlRequestManager() {
(...skipping 22 matching lines...) Expand all
1438 privacy_info_.privacy_records[UTF8ToWide(url)]; 1439 privacy_info_.privacy_records[UTF8ToWide(url)];
1439 1440
1440 privacy_entry.flags |= flags; 1441 privacy_entry.flags |= flags;
1441 privacy_entry.policy_ref = UTF8ToWide(policy_ref); 1442 privacy_entry.policy_ref = UTF8ToWide(policy_ref);
1442 1443
1443 if (fire_privacy_event && IsWindow(notification_window_)) { 1444 if (fire_privacy_event && IsWindow(notification_window_)) {
1444 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, 1445 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1,
1445 0); 1446 0);
1446 } 1447 }
1447 } 1448 }
1448
1449 UrlmonUrlRequestManager::ResourceFetcherThread::ResourceFetcherThread(
1450 const char* name) : base::Thread(name) {
1451 }
1452
1453 UrlmonUrlRequestManager::ResourceFetcherThread::~ResourceFetcherThread() {
1454 Stop();
1455 }
1456
1457 void UrlmonUrlRequestManager::ResourceFetcherThread::Init() {
1458 com_initializer_.reset(new base::win::ScopedCOMInitializer());
1459 }
1460
1461 void UrlmonUrlRequestManager::ResourceFetcherThread::CleanUp() {
1462 com_initializer_.reset();
1463 }
OLDNEW
« no previous file with comments | « chrome_frame/urlmon_url_request.h ('k') | chrome_frame/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698