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

Side by Side Diff: chrome/browser/profiles/profile_io_data.cc

Issue 7649016: Removing singleton property of MediaStreamManager and creating thread first when needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changing unit tests based on review by scherkus. Created 9 years, 3 months 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser/profiles/profile_io_data.h" 5 #include "chrome/browser/profiles/profile_io_data.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 23 matching lines...) Expand all
34 #include "chrome/browser/profiles/profile_manager.h" 34 #include "chrome/browser/profiles/profile_manager.h"
35 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" 35 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
36 #include "chrome/common/chrome_notification_types.h" 36 #include "chrome/common/chrome_notification_types.h"
37 #include "chrome/common/chrome_switches.h" 37 #include "chrome/common/chrome_switches.h"
38 #include "chrome/common/pref_names.h" 38 #include "chrome/common/pref_names.h"
39 #include "chrome/common/url_constants.h" 39 #include "chrome/common/url_constants.h"
40 #include "content/browser/appcache/chrome_appcache_service.h" 40 #include "content/browser/appcache/chrome_appcache_service.h"
41 #include "content/browser/browser_thread.h" 41 #include "content/browser/browser_thread.h"
42 #include "content/browser/chrome_blob_storage_context.h" 42 #include "content/browser/chrome_blob_storage_context.h"
43 #include "content/browser/host_zoom_map.h" 43 #include "content/browser/host_zoom_map.h"
44 #include "content/browser/renderer_host/media/media_stream_manager.h"
44 #include "content/browser/renderer_host/resource_dispatcher_host.h" 45 #include "content/browser/renderer_host/resource_dispatcher_host.h"
45 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" 46 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
46 #include "content/browser/resource_context.h" 47 #include "content/browser/resource_context.h"
47 #include "content/common/notification_service.h" 48 #include "content/common/notification_service.h"
48 #include "net/http/http_transaction_factory.h" 49 #include "net/http/http_transaction_factory.h"
49 #include "net/http/http_util.h" 50 #include "net/http/http_util.h"
50 #include "net/proxy/proxy_config_service_fixed.h" 51 #include "net/proxy/proxy_config_service_fixed.h"
51 #include "net/proxy/proxy_script_fetcher_impl.h" 52 #include "net/proxy/proxy_script_fetcher_impl.h"
52 #include "net/proxy/proxy_service.h" 53 #include "net/proxy/proxy_service.h"
53 #include "net/url_request/url_request.h" 54 #include "net/url_request/url_request.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); 455 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
455 DCHECK(set_protocol); 456 DCHECK(set_protocol);
456 #if defined(OS_CHROMEOS) 457 #if defined(OS_CHROMEOS)
457 // Install the GView request interceptor that will redirect requests 458 // Install the GView request interceptor that will redirect requests
458 // of compatible documents (PDF, etc) to the GView document viewer. 459 // of compatible documents (PDF, etc) to the GView document viewer.
459 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 460 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
460 if (parsed_command_line.HasSwitch(switches::kEnableGView)) 461 if (parsed_command_line.HasSwitch(switches::kEnableGView))
461 job_factory_->AddInterceptor(new chromeos::GViewRequestInterceptor); 462 job_factory_->AddInterceptor(new chromeos::GViewRequestInterceptor);
462 #endif // defined(OS_CHROMEOS) 463 #endif // defined(OS_CHROMEOS)
463 464
465 media_stream_manager_.reset(new media_stream::MediaStreamManager);
466
464 // Take ownership over these parameters. 467 // Take ownership over these parameters.
465 database_tracker_ = profile_params_->database_tracker; 468 database_tracker_ = profile_params_->database_tracker;
466 appcache_service_ = profile_params_->appcache_service; 469 appcache_service_ = profile_params_->appcache_service;
467 blob_storage_context_ = profile_params_->blob_storage_context; 470 blob_storage_context_ = profile_params_->blob_storage_context;
468 file_system_context_ = profile_params_->file_system_context; 471 file_system_context_ = profile_params_->file_system_context;
469 quota_manager_ = profile_params_->quota_manager; 472 quota_manager_ = profile_params_->quota_manager;
470 host_zoom_map_ = profile_params_->host_zoom_map; 473 host_zoom_map_ = profile_params_->host_zoom_map;
471 host_content_settings_map_ = profile_params_->host_content_settings_map; 474 host_content_settings_map_ = profile_params_->host_content_settings_map;
472 notification_service_ = profile_params_->notification_service; 475 notification_service_ = profile_params_->notification_service;
473 extension_info_map_ = profile_params_->extension_info_map; 476 extension_info_map_ = profile_params_->extension_info_map;
474 prerender_manager_getter_ = profile_params_->prerender_manager_getter; 477 prerender_manager_getter_ = profile_params_->prerender_manager_getter;
475 478
476 resource_context_.set_host_resolver(io_thread_globals->host_resolver.get()); 479 resource_context_.set_host_resolver(io_thread_globals->host_resolver.get());
477 resource_context_.set_request_context(main_request_context_); 480 resource_context_.set_request_context(main_request_context_);
478 resource_context_.set_database_tracker(database_tracker_); 481 resource_context_.set_database_tracker(database_tracker_);
479 resource_context_.set_appcache_service(appcache_service_); 482 resource_context_.set_appcache_service(appcache_service_);
480 resource_context_.set_blob_storage_context(blob_storage_context_); 483 resource_context_.set_blob_storage_context(blob_storage_context_);
481 resource_context_.set_file_system_context(file_system_context_); 484 resource_context_.set_file_system_context(file_system_context_);
482 resource_context_.set_quota_manager(quota_manager_); 485 resource_context_.set_quota_manager(quota_manager_);
483 resource_context_.set_host_zoom_map(host_zoom_map_); 486 resource_context_.set_host_zoom_map(host_zoom_map_);
484 resource_context_.set_prerender_manager_getter(prerender_manager_getter_); 487 resource_context_.set_prerender_manager_getter(prerender_manager_getter_);
485 resource_context_.SetUserData(NULL, const_cast<ProfileIOData*>(this)); 488 resource_context_.SetUserData(NULL, const_cast<ProfileIOData*>(this));
486 resource_context_.set_media_observer( 489 resource_context_.set_media_observer(
487 io_thread_globals->media.media_internals.get()); 490 io_thread_globals->media.media_internals.get());
491 resource_context_.set_media_stream_manager(media_stream_manager_.get());
488 492
489 LazyInitializeInternal(profile_params_.get()); 493 LazyInitializeInternal(profile_params_.get());
490 494
491 profile_params_.reset(); 495 profile_params_.reset();
492 initialized_ = true; 496 initialized_ = true;
493 } 497 }
494 498
495 void ProfileIOData::ApplyProfileParamsToContext( 499 void ProfileIOData::ApplyProfileParamsToContext(
496 ChromeURLRequestContext* context) const { 500 ChromeURLRequestContext* context) const {
497 context->set_is_incognito(profile_params_->is_incognito); 501 context->set_is_incognito(profile_params_->is_incognito);
(...skipping 14 matching lines...) Expand all
512 BrowserThread::IO, FROM_HERE, 516 BrowserThread::IO, FROM_HERE,
513 base::Bind( 517 base::Bind(
514 &ResourceDispatcherHost::CancelRequestsForContext, 518 &ResourceDispatcherHost::CancelRequestsForContext,
515 base::Unretained(g_browser_process->resource_dispatcher_host()), 519 base::Unretained(g_browser_process->resource_dispatcher_host()),
516 &resource_context_)); 520 &resource_context_));
517 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 521 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
518 new DeleteTask<ProfileIOData>(this)); 522 new DeleteTask<ProfileIOData>(this));
519 if (!posted) 523 if (!posted)
520 delete this; 524 delete this;
521 } 525 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698