diff options
Diffstat (limited to 'chrome/browser')
27 files changed, 123 insertions, 97 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 139f20d..691061f 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -34,7 +34,6 @@ include_rules = [ "+content/browser/accessibility/browser_accessibility_manager.h", "+content/browser/accessibility/browser_accessibility_state.h", "+content/browser/appcache/chrome_appcache_service.h", - "+content/browser/browser_child_process_host.h", "+content/browser/browser_thread_impl.h", "+content/browser/browser_url_handler.h", "+content/browser/cert_store.h", diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index a417f6c..0600163 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -117,6 +117,8 @@ #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/interstitial_page.h" +#include "content/public/browser/browser_child_process_host_iterator.h" +#include "content/public/browser/child_process_data.h" #include "content/public/browser/favicon_status.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" @@ -151,6 +153,7 @@ using automation::Error; using automation::ErrorCode; using automation_util::SendErrorIfModalDialogActive; +using content::BrowserChildProcessHostIterator; using content::BrowserThread; using content::ChildProcessHost; using content::DownloadItem; @@ -2773,20 +2776,18 @@ void TestingAutomationProvider::PerformActionOnInfobar( namespace { // Gets info about BrowserChildProcessHost. Must run on IO thread to -// honor the semantics of BrowserChildProcessHost. +// honor the semantics of BrowserChildProcessHostIterator. // Used by AutomationProvider::GetBrowserInfo(). void GetChildProcessHostInfo(ListValue* child_processes) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - for (BrowserChildProcessHost::Iterator iter; !iter.Done(); ++iter) { - // Only add processes which are already started, - // since we need their handle. - if ((*iter)->data().handle == base::kNullProcessHandle) + for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { + // Only add processes which are already started, since we need their handle. + if (iter.GetData().handle == base::kNullProcessHandle) continue; DictionaryValue* item = new DictionaryValue; - item->SetString("name", iter->data().name); + item->SetString("name", iter.GetData().name); item->SetString("type", - content::GetProcessTypeNameInEnglish(iter->data().type)); - item->SetInteger("pid", base::GetProcId(iter->data().handle)); + content::GetProcessTypeNameInEnglish(iter.GetData().type)); + item->SetInteger("pid", base::GetProcId(iter.GetData().handle)); child_processes->Append(item); } } diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 2f45144..ba2bd92 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -66,7 +66,6 @@ #include "chrome/common/switch_utils.h" #include "chrome/common/url_constants.h" #include "chrome/installer/util/google_update_constants.h" -#include "content/browser/browser_child_process_host.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/download/download_status_updater.h" #include "content/browser/download/mhtml_generation_manager.h" diff --git a/chrome/browser/debugger/devtools_sanity_unittest.cc b/chrome/browser/debugger/devtools_sanity_unittest.cc index 0852321..41363e5 100644 --- a/chrome/browser/debugger/devtools_sanity_unittest.cc +++ b/chrome/browser/debugger/devtools_sanity_unittest.cc @@ -25,6 +25,8 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/worker_host/worker_process_host.h" +#include "content/public/browser/browser_child_process_host_iterator.h" +#include "content/public/browser/child_process_data.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/devtools_agent_host_registry.h" #include "content/public/browser/devtools_client_host.h" @@ -292,7 +294,7 @@ class WorkerDevToolsSanityTest : public InProcessBrowserTest { virtual void WorkerCreated ( WorkerProcessHost* process, const WorkerProcessHost::WorkerInstance& instance) OVERRIDE { - worker_data_->worker_process_id = process->data().id; + worker_data_->worker_process_id = process->GetData().id; worker_data_->worker_route_id = instance.worker_route_id(); WorkerService::GetInstance()->RemoveObserver(this); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, @@ -323,7 +325,7 @@ class WorkerDevToolsSanityTest : public InProcessBrowserTest { virtual void WorkerDestroyed( WorkerProcessHost* process, int worker_route_id) OVERRIDE { - ASSERT_EQ(worker_data_->worker_process_id, process->data().id); + ASSERT_EQ(worker_data_->worker_process_id, process->GetData().id); ASSERT_EQ(worker_data_->worker_route_id, worker_route_id); WorkerService::GetInstance()->RemoveObserver(this); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, @@ -349,11 +351,9 @@ class WorkerDevToolsSanityTest : public InProcessBrowserTest { static void TerminateWorkerOnIOThread( scoped_refptr<WorkerData> worker_data) { - for (BrowserChildProcessHost::Iterator iter(content::PROCESS_TYPE_WORKER); - !iter.Done(); ++iter) { - if (iter->data().id == worker_data->worker_process_id) { - WorkerProcessHost* host = static_cast<WorkerProcessHost*>(*iter); - host->TerminateWorker(worker_data->worker_route_id); + for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) { + if (iter.GetData().id == worker_data->worker_process_id) { + iter->TerminateWorker(worker_data->worker_route_id); WorkerService::GetInstance()->AddObserver( new WorkerTerminationObserver(worker_data)); return; @@ -371,14 +371,12 @@ class WorkerDevToolsSanityTest : public InProcessBrowserTest { static void WaitForFirstSharedWorkerOnIOThread( scoped_refptr<WorkerData> worker_data) { - BrowserChildProcessHost::Iterator iter(content::PROCESS_TYPE_WORKER); - for (; !iter.Done(); ++iter) { - WorkerProcessHost* worker = static_cast<WorkerProcessHost*>(*iter); - const WorkerProcessHost::Instances& instances = worker->instances(); + for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) { + const WorkerProcessHost::Instances& instances = iter->instances(); for (WorkerProcessHost::Instances::const_iterator i = instances.begin(); i != instances.end(); ++i) { - worker_data->worker_process_id = worker->data().id; + worker_data->worker_process_id = iter.GetData().id; worker_data->worker_route_id = i->worker_route_id(); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, MessageLoop::QuitClosure()); diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index 03e2c3c..6333a30 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -10,6 +10,7 @@ #include "base/base64.h" #include "base/bind.h" #include "base/memory/ref_counted_memory.h" +#include "base/message_loop.h" #include "base/stl_util.h" #include "base/string16.h" #include "base/string_number_conversions.h" diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc b/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc index 68bc2e9..5e19010 100644 --- a/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc +++ b/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc @@ -4,6 +4,7 @@ #include "base/file_util.h" #include "base/memory/ref_counted.h" +#include "base/message_loop.h" #include "base/path_service.h" #include "base/scoped_temp_dir.h" #include "base/scoped_temp_dir.h" diff --git a/chrome/browser/intents/web_intents_registry_unittest.cc b/chrome/browser/intents/web_intents_registry_unittest.cc index 3957064..a6de0bb 100644 --- a/chrome/browser/intents/web_intents_registry_unittest.cc +++ b/chrome/browser/intents/web_intents_registry_unittest.cc @@ -4,6 +4,7 @@ #include "base/file_util.h" #include "base/json/json_value_serializer.h" +#include "base/message_loop.h" #include "base/path_service.h" #include "base/scoped_temp_dir.h" #include "base/utf_string_conversions.h" diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index 727bb99..b93b79c 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -16,7 +16,8 @@ #include "chrome/common/chrome_view_type.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" -#include "content/browser/browser_child_process_host.h" +#include "content/public/browser/browser_child_process_host_iterator.h" +#include "content/public/browser/child_process_data.h" #include "content/browser/renderer_host/backing_store_manager.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/public/browser/browser_thread.h" @@ -36,6 +37,7 @@ #include "content/browser/zygote_host_linux.h" #endif +using content::BrowserChildProcessHostIterator; using content::BrowserThread; using content::NavigationEntry; using content::WebContents; @@ -133,15 +135,15 @@ void MemoryDetails::CollectChildInfoOnIOThread() { std::vector<ProcessMemoryInformation> child_info; // Collect the list of child processes. - for (BrowserChildProcessHost::Iterator iter; !iter.Done(); ++iter) { + for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { ProcessMemoryInformation info; - info.pid = base::GetProcId(iter->data().handle); + info.pid = base::GetProcId(iter.GetData().handle); if (!info.pid) continue; - info.type = iter->data().type; + info.type = iter.GetData().type; info.renderer_type = ProcessMemoryInformation::RENDERER_UNKNOWN; - info.titles.push_back(iter->data().name); + info.titles.push_back(iter.GetData().name); child_info.push_back(info); } diff --git a/chrome/browser/memory_details_linux.cc b/chrome/browser/memory_details_linux.cc index d4baa68..0d47086 100644 --- a/chrome/browser/memory_details_linux.cc +++ b/chrome/browser/memory_details_linux.cc @@ -18,7 +18,6 @@ #include "base/utf_string_conversions.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/url_constants.h" -#include "content/browser/browser_child_process_host.h" #include "content/browser/zygote_host_linux.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/process_type.h" diff --git a/chrome/browser/memory_details_mac.cc b/chrome/browser/memory_details_mac.cc index 5d9ab92..d005150 100644 --- a/chrome/browser/memory_details_mac.cc +++ b/chrome/browser/memory_details_mac.cc @@ -20,7 +20,6 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/url_constants.h" -#include "content/browser/browser_child_process_host.h" #include "content/browser/renderer_host/backing_store_manager.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/process_type.h" diff --git a/chrome/browser/memory_details_win.cc b/chrome/browser/memory_details_win.cc index 09cd799..0e1da5e4 100644 --- a/chrome/browser/memory_details_win.cc +++ b/chrome/browser/memory_details_win.cc @@ -15,7 +15,6 @@ #include "base/win/windows_version.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/url_constants.h" -#include "content/browser/browser_child_process_host.h" #include "content/browser/renderer_host/backing_store_manager.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/process_type.h" diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index 305c930..c0cf20b 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -177,6 +177,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "content/browser/load_notification_details.h" +#include "content/public/browser/child_process_data.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/plugin_service.h" #include "content/public/browser/render_process_host.h" @@ -196,6 +197,7 @@ using base::Time; using content::BrowserThread; +using content::ChildProcessData; using content::PluginService; // Check to see that we're being called on only one thread. @@ -1335,7 +1337,7 @@ void MetricsService::LogChildProcessChange( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - content::Details<content::ChildProcessData> child_details(details); + content::Details<ChildProcessData> child_details(details); const string16& child_name = child_details->name; if (child_process_stats_buffer_.find(child_name) == diff --git a/chrome/browser/nacl_host/nacl_broker_host_win.cc b/chrome/browser/nacl_host/nacl_broker_host_win.cc index d64c1ea..186e15e 100644 --- a/chrome/browser/nacl_host/nacl_broker_host_win.cc +++ b/chrome/browser/nacl_host/nacl_broker_host_win.cc @@ -14,11 +14,13 @@ #include "chrome/common/logging_chrome.h" #include "chrome/common/nacl_cmd_line.h" #include "chrome/common/nacl_messages.h" +#include "content/public/browser/browser_child_process_host.h" #include "content/public/common/child_process_host.h" NaClBrokerHost::NaClBrokerHost() - : BrowserChildProcessHost(content::PROCESS_TYPE_NACL_BROKER), - stopping_(false) { + : stopping_(false) { + process_.reset(content::BrowserChildProcessHost::Create( + content::PROCESS_TYPE_NACL_BROKER, this)); } NaClBrokerHost::~NaClBrokerHost() { @@ -26,7 +28,7 @@ NaClBrokerHost::~NaClBrokerHost() { bool NaClBrokerHost::Init() { // Create the channel that will be used for communicating with the broker. - std::string channel_id = child_process_host()->CreateChannel(); + std::string channel_id = process_->GetHost()->CreateChannel(); if (channel_id.empty()) return false; @@ -45,7 +47,7 @@ bool NaClBrokerHost::Init() { if (logging::DialogsAreSuppressed()) cmd_line->AppendSwitch(switches::kNoErrorDialogs); - BrowserChildProcessHost::Launch(FilePath(), cmd_line); + process_->Launch(FilePath(), cmd_line); return true; } @@ -60,7 +62,8 @@ bool NaClBrokerHost::OnMessageReceived(const IPC::Message& msg) { bool NaClBrokerHost::LaunchLoader( const std::wstring& loader_channel_id) { - return Send(new NaClProcessMsg_LaunchLoaderThroughBroker(loader_channel_id)); + return process_->Send( + new NaClProcessMsg_LaunchLoaderThroughBroker(loader_channel_id)); } void NaClBrokerHost::OnLoaderLaunched(const std::wstring& loader_channel_id, @@ -70,5 +73,5 @@ void NaClBrokerHost::OnLoaderLaunched(const std::wstring& loader_channel_id, void NaClBrokerHost::StopBroker() { stopping_ = true; - Send(new NaClProcessMsg_StopBroker()); + process_->Send(new NaClProcessMsg_StopBroker()); } diff --git a/chrome/browser/nacl_host/nacl_broker_host_win.h b/chrome/browser/nacl_host/nacl_broker_host_win.h index bcb3a44..368f462 100644 --- a/chrome/browser/nacl_host/nacl_broker_host_win.h +++ b/chrome/browser/nacl_host/nacl_broker_host_win.h @@ -7,9 +7,15 @@ #pragma once #include "base/basictypes.h" -#include "content/browser/browser_child_process_host.h" +#include "base/memory/scoped_ptr.h" +#include "base/process.h" +#include "content/public/browser/browser_child_process_host_delegate.h" -class NaClBrokerHost : public BrowserChildProcessHost { +namespace content { +class BrowserChildProcessHost; +} + +class NaClBrokerHost : public content::BrowserChildProcessHostDelegate { public: NaClBrokerHost(); ~NaClBrokerHost(); @@ -30,11 +36,13 @@ class NaClBrokerHost : public BrowserChildProcessHost { void OnLoaderLaunched(const std::wstring& loader_channel_id, base::ProcessHandle handle); - // BrowserChildProcessHost implementation: + // BrowserChildProcessHostDelegate implementation: virtual bool OnMessageReceived(const IPC::Message& msg); bool stopping_; + scoped_ptr<content::BrowserChildProcessHost> process_; + DISALLOW_COPY_AND_ASSIGN(NaClBrokerHost); }; diff --git a/chrome/browser/nacl_host/nacl_broker_service_win.cc b/chrome/browser/nacl_host/nacl_broker_service_win.cc index 7e93e3e..8b7bd90b 100644 --- a/chrome/browser/nacl_host/nacl_broker_service_win.cc +++ b/chrome/browser/nacl_host/nacl_broker_service_win.cc @@ -5,6 +5,9 @@ #include "chrome/browser/nacl_host/nacl_broker_service_win.h" #include "chrome/browser/nacl_host/nacl_process_host.h" +#include "content/public/browser/browser_child_process_host_iterator.h" + +using content::BrowserChildProcessHostIterator; NaClBrokerService* NaClBrokerService::GetInstance() { return Singleton<NaClBrokerService>::get(); @@ -62,9 +65,8 @@ void NaClBrokerService::OnLoaderDied() { } NaClBrokerHost* NaClBrokerService::GetBrokerHost() { - BrowserChildProcessHost::Iterator iter(content::PROCESS_TYPE_NACL_BROKER); + BrowserChildProcessHostIterator iter(content::PROCESS_TYPE_NACL_BROKER); if (iter.Done()) return NULL; - NaClBrokerHost* broker_host = static_cast<NaClBrokerHost*>(*iter); - return broker_host; + return static_cast<NaClBrokerHost*>(iter.GetDelegate()); } diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc index da2ae24..7d8ddd3 100644 --- a/chrome/browser/nacl_host/nacl_process_host.cc +++ b/chrome/browser/nacl_host/nacl_process_host.cc @@ -24,6 +24,8 @@ #include "chrome/common/nacl_messages.h" #include "chrome/common/render_messages.h" #include "chrome/browser/renderer_host/chrome_render_message_filter.h" +#include "content/public/browser/browser_child_process_host.h" +#include "content/public/browser/child_process_data.h" #include "content/public/common/child_process_host.h" #include "ipc/ipc_switches.h" #include "native_client/src/shared/imc/nacl_imc.h" @@ -35,6 +37,7 @@ #endif using content::BrowserThread; +using content::ChildProcessData; using content::ChildProcessHost; namespace { @@ -109,16 +112,17 @@ static bool RunningOnWOW64() { #endif NaClProcessHost::NaClProcessHost(const std::wstring& url) - : BrowserChildProcessHost(content::PROCESS_TYPE_NACL_LOADER), - reply_msg_(NULL), + : reply_msg_(NULL), internal_(new NaClInternal()), ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { - SetName(WideToUTF16Hack(url)); + process_.reset(content::BrowserChildProcessHost::Create( + content::PROCESS_TYPE_NACL_LOADER, this)); + process_->SetName(WideToUTF16Hack(url)); } NaClProcessHost::~NaClProcessHost() { int exit_code; - GetChildTerminationStatus(&exit_code); + process_->GetTerminationStatus(&exit_code); std::string message = base::StringPrintf("NaCl process exited with status %i (0x%x)", exit_code, exit_code); @@ -234,7 +238,7 @@ bool NaClProcessHost::Launch( } bool NaClProcessHost::LaunchSelLdr() { - std::string channel_id = child_process_host()->CreateChannel(); + std::string channel_id = process_->GetHost()->CreateChannel(); if (channel_id.empty()) return false; @@ -283,19 +287,19 @@ bool NaClProcessHost::LaunchSelLdr() { return NaClBrokerService::GetInstance()->LaunchLoader( this, ASCIIToWide(channel_id)); } else { - BrowserChildProcessHost::Launch(FilePath(), cmd_line); + process_->Launch(FilePath(), cmd_line); } #elif defined(OS_POSIX) - BrowserChildProcessHost::Launch(nacl_loader_prefix.empty(), // use_zygote - base::environment_vector(), - cmd_line); + process_->Launch(nacl_loader_prefix.empty(), // use_zygote + base::environment_vector(), + cmd_line); #endif return true; } void NaClProcessHost::OnProcessLaunchedByBroker(base::ProcessHandle handle) { - SetHandle(handle); + process_->SetHandle(handle); OnProcessLaunched(); } @@ -469,10 +473,11 @@ void NaClProcessHost::SendStart(base::PlatformFile irt_file) { #endif } + const ChildProcessData& data = process_->GetData(); #if defined(OS_WIN) // Copy the process handle into the renderer process. if (!DuplicateHandle(base::GetCurrentProcessHandle(), - data().handle, + data.handle, chrome_render_message_filter_->peer_handle(), &nacl_process_handle, PROCESS_DUP_HANDLE, @@ -484,11 +489,11 @@ void NaClProcessHost::SendStart(base::PlatformFile irt_file) { } #else // We use pid as process handle on Posix - nacl_process_handle = data().handle; + nacl_process_handle = data.handle; #endif // Get the pid of the NaCl process - base::ProcessId nacl_process_id = base::GetProcId(data().handle); + base::ProcessId nacl_process_id = base::GetProcId(data.handle); ChromeViewHostMsg_LaunchNaCl::WriteReplyParams( reply_msg_, handles_for_renderer, nacl_process_handle, nacl_process_id); @@ -499,7 +504,7 @@ void NaClProcessHost::SendStart(base::PlatformFile irt_file) { std::vector<nacl::FileDescriptor> handles_for_sel_ldr; for (size_t i = 0; i < internal_->sockets_for_sel_ldr.size(); i++) { - if (!SendHandleToSelLdr(data().handle, + if (!SendHandleToSelLdr(data.handle, internal_->sockets_for_sel_ldr[i], true, &handles_for_sel_ldr)) { delete this; @@ -508,8 +513,7 @@ void NaClProcessHost::SendStart(base::PlatformFile irt_file) { } // Send over the IRT file handle. We don't close our own copy! - if (!SendHandleToSelLdr( - data().handle, irt_file, false, &handles_for_sel_ldr)) { + if (!SendHandleToSelLdr(data.handle, irt_file, false, &handles_for_sel_ldr)) { delete this; return; } @@ -539,7 +543,7 @@ void NaClProcessHost::SendStart(base::PlatformFile irt_file) { handles_for_sel_ldr.push_back(memory_fd); #endif - Send(new NaClProcessMsg_Start(handles_for_sel_ldr)); + process_->Send(new NaClProcessMsg_Start(handles_for_sel_ldr)); internal_->sockets_for_sel_ldr.clear(); } diff --git a/chrome/browser/nacl_host/nacl_process_host.h b/chrome/browser/nacl_host/nacl_process_host.h index 0677801..56f0553 100644 --- a/chrome/browser/nacl_host/nacl_process_host.h +++ b/chrome/browser/nacl_host/nacl_process_host.h @@ -12,18 +12,23 @@ #include "base/file_util_proxy.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" +#include "base/process.h" #include "chrome/common/nacl_types.h" -#include "content/browser/browser_child_process_host.h" +#include "content/public/browser/browser_child_process_host_delegate.h" class ChromeRenderMessageFilter; +namespace content { +class BrowserChildProcessHost; +} + // Represents the browser side of the browser <--> NaCl communication // channel. There will be one NaClProcessHost per NaCl process // The browser is responsible for starting the NaCl process // when requested by the renderer. // After that, most of the communication is directly between NaCl plugin // running in the renderer and NaCl processes. -class NaClProcessHost : public BrowserChildProcessHost { +class NaClProcessHost : public content::BrowserChildProcessHostDelegate { public: explicit NaClProcessHost(const std::wstring& url); virtual ~NaClProcessHost(); @@ -39,10 +44,6 @@ class NaClProcessHost : public BrowserChildProcessHost { int socket_count, IPC::Message* reply_msg); - // BrowserChildProcessHost implementation: - virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; - virtual void OnProcessCrashed(int exit_code) OVERRIDE; - void OnProcessLaunchedByBroker(base::ProcessHandle handle); private: @@ -54,6 +55,9 @@ class NaClProcessHost : public BrowserChildProcessHost { bool LaunchSelLdr(); + // BrowserChildProcessHostDelegate implementation: + virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; + virtual void OnProcessCrashed(int exit_code) OVERRIDE; virtual void OnProcessLaunched() OVERRIDE; void IrtReady(); @@ -74,6 +78,8 @@ class NaClProcessHost : public BrowserChildProcessHost { base::WeakPtrFactory<NaClProcessHost> weak_factory_; + scoped_ptr<content::BrowserChildProcessHost> process_; + DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); }; diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index d47c0d8..5a8e571 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -28,7 +28,6 @@ #include "chrome/common/content_settings_pattern.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" -#include "content/browser/browser_child_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/site_instance.h" #include "content/browser/worker_host/worker_process_host.h" diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc index 383c7ef..19cf9e8 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager/task_manager_resource_providers.cc @@ -41,9 +41,10 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" -#include "content/browser/browser_child_process_host.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/public/browser/browser_child_process_host_iterator.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/child_process_data.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" @@ -64,6 +65,7 @@ #include "ui/gfx/icon_util.h" #endif // defined(OS_WIN) +using content::BrowserChildProcessHostIterator; using content::BrowserThread; using content::WebContents; @@ -1068,11 +1070,11 @@ void TaskManagerChildProcessResourceProvider::AddToTaskManager( // The ChildProcessData::Iterator has to be used from the IO thread. void TaskManagerChildProcessResourceProvider::RetrieveChildProcessData() { std::vector<content::ChildProcessData> child_processes; - for (BrowserChildProcessHost::Iterator iter; !iter.Done(); ++iter) { + for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { // Only add processes which are already started, since we need their handle. - if ((*iter)->data().handle == base::kNullProcessHandle) + if (iter.GetData().handle == base::kNullProcessHandle) continue; - child_processes.push_back((*iter)->data()); + child_processes.push_back(iter.GetData()); } // Now notify the UI thread that we have retrieved information about child // processes. diff --git a/chrome/browser/task_manager/task_manager_worker_resource_provider.cc b/chrome/browser/task_manager/task_manager_worker_resource_provider.cc index a3fccb6..5712732 100644 --- a/chrome/browser/task_manager/task_manager_worker_resource_provider.cc +++ b/chrome/browser/task_manager/task_manager_worker_resource_provider.cc @@ -11,7 +11,6 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/debugger/devtools_window.h" #include "chrome/browser/profiles/profile_manager.h" -#include "content/browser/browser_child_process_host.h" #include "content/browser/worker_host/worker_process_host.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_data.h" @@ -218,7 +217,7 @@ void TaskManagerWorkerResourceProvider::WorkerCreated( WorkerProcessHost* process, const WorkerProcessHost::WorkerInstance& instance) { TaskManagerSharedWorkerResource* resource = - new TaskManagerSharedWorkerResource(process->data(), + new TaskManagerSharedWorkerResource(process->GetData(), instance.worker_route_id(), instance.url(), instance.name()); BrowserThread::PostTask( @@ -233,7 +232,7 @@ void TaskManagerWorkerResourceProvider::WorkerDestroyed( BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind( &TaskManagerWorkerResourceProvider::NotifyWorkerDestroyed, - this, process->data().id, worker_route_id)); + this, process->GetData().id, worker_route_id)); } void TaskManagerWorkerResourceProvider::Observe( @@ -304,14 +303,12 @@ void TaskManagerWorkerResourceProvider::StartObservingWorkers() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); scoped_ptr<WorkerResourceListHolder> holder(new WorkerResourceListHolder); - BrowserChildProcessHost::Iterator iter(content::PROCESS_TYPE_WORKER); - for (; !iter.Done(); ++iter) { - WorkerProcessHost* worker = static_cast<WorkerProcessHost*>(*iter); - const WorkerProcessHost::Instances& instances = worker->instances(); + for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) { + const WorkerProcessHost::Instances& instances = (*iter)->instances(); for (WorkerProcessHost::Instances::const_iterator i = instances.begin(); i != instances.end(); ++i) { holder->resources()->push_back(new TaskManagerSharedWorkerResource( - (*iter)->data(), i->worker_route_id(), i->url(), i->name())); + iter.GetData(), i->worker_route_id(), i->url(), i->name())); } } diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm index 79ecf8c..9631228 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm @@ -5,6 +5,7 @@ #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" #include "base/bind.h" +#include "base/message_loop.h" #include "base/stl_util.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc index 3643935..5ae03d6 100644 --- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc @@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/i18n/rtl.h" +#include "base/message_loop.h" #include "base/utf_string_conversions.h" #include "chrome/browser/extensions/extension_browser_event_router.h" #include "chrome/browser/extensions/extension_context_menu_model.h" diff --git a/chrome/browser/ui/intents/web_intents_model_unittest.cc b/chrome/browser/ui/intents/web_intents_model_unittest.cc index ee4f287..a2fbe2e 100644 --- a/chrome/browser/ui/intents/web_intents_model_unittest.cc +++ b/chrome/browser/ui/intents/web_intents_model_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/file_util.h" +#include "base/message_loop.h" #include "base/scoped_temp_dir.h" #include "base/synchronization/waitable_event.h" #include "base/utf_string_conversions.h" diff --git a/chrome/browser/ui/webui/options/chromeos/user_image_source.cc b/chrome/browser/ui/webui/options/chromeos/user_image_source.cc index 65d16d6..c5297df 100644 --- a/chrome/browser/ui/webui/options/chromeos/user_image_source.cc +++ b/chrome/browser/ui/webui/options/chromeos/user_image_source.cc @@ -5,6 +5,7 @@ #include "chrome/browser/ui/webui/options/chromeos/user_image_source.h" #include "base/memory/ref_counted_memory.h" +#include "base/message_loop.h" #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/common/url_constants.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/ui/webui/options2/chromeos/user_image_source2.cc b/chrome/browser/ui/webui/options2/chromeos/user_image_source2.cc index 3b838ea..eae0385 100644 --- a/chrome/browser/ui/webui/options2/chromeos/user_image_source2.cc +++ b/chrome/browser/ui/webui/options2/chromeos/user_image_source2.cc @@ -5,6 +5,7 @@ #include "chrome/browser/ui/webui/options2/chromeos/user_image_source2.h" #include "base/memory/ref_counted_memory.h" +#include "base/message_loop.h" #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/common/url_constants.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/ui/webui/workers_ui.cc b/chrome/browser/ui/webui/workers_ui.cc index 5917d49..313a7e7 100644 --- a/chrome/browser/ui/webui/workers_ui.cc +++ b/chrome/browser/ui/webui/workers_ui.cc @@ -17,6 +17,7 @@ #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" #include "chrome/common/url_constants.h" #include "content/browser/worker_host/worker_process_host.h" +#include "content/public/browser/child_process_data.h" #include "content/public/browser/devtools_agent_host_registry.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents.h" @@ -30,6 +31,7 @@ #include "ui/base/resource/resource_bundle.h" using content::BrowserThread; +using content::ChildProcessData; using content::DevToolsAgentHost; using content::DevToolsAgentHostRegistry; using content::WebContents; @@ -51,15 +53,14 @@ static const char kPidField[] = "pid"; namespace { -DictionaryValue* BuildWorkerData( - WorkerProcessHost* process, +DictionaryValue* BuildWorkerData(const ChildProcessData& data, const WorkerProcessHost::WorkerInstance& instance) { DictionaryValue* worker_data = new DictionaryValue(); - worker_data->SetInteger(kWorkerProcessHostIdField, process->data().id); + worker_data->SetInteger(kWorkerProcessHostIdField, data.id); worker_data->SetInteger(kWorkerRouteIdField, instance.worker_route_id()); worker_data->SetString(kUrlField, instance.url().spec()); worker_data->SetString(kNameField, instance.name()); - worker_data->SetInteger(kPidField, base::GetProcId(process->data().handle)); + worker_data->SetInteger(kPidField, base::GetProcId(data.handle)); return worker_data; } @@ -94,13 +95,11 @@ void WorkersUIHTMLSource::StartDataRequest(const std::string& path, void WorkersUIHTMLSource::SendSharedWorkersData(int request_id) { ListValue workers_list; - BrowserChildProcessHost::Iterator iter(content::PROCESS_TYPE_WORKER); - for (; !iter.Done(); ++iter) { - WorkerProcessHost* worker = static_cast<WorkerProcessHost*>(*iter); - const WorkerProcessHost::Instances& instances = worker->instances(); + for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) { + const WorkerProcessHost::Instances& instances = iter->instances(); for (WorkerProcessHost::Instances::const_iterator i = instances.begin(); i != instances.end(); ++i) { - workers_list.Append(BuildWorkerData(worker, *i)); + workers_list.Append(BuildWorkerData(iter.GetData(), *i)); } } @@ -158,11 +157,9 @@ void WorkersDOMHandler::HandleOpenDevTools(const ListValue* args) { } static void TerminateWorker(int worker_process_id, int worker_route_id) { - for (BrowserChildProcessHost::Iterator iter(content::PROCESS_TYPE_WORKER); - !iter.Done(); ++iter) { - if (iter->data().id == worker_process_id) { - WorkerProcessHost* worker = static_cast<WorkerProcessHost*>(*iter); - worker->TerminateWorker(worker_route_id); + for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) { + if (iter.GetData().id == worker_process_id) { + iter->TerminateWorker(worker_route_id); return; } } @@ -216,14 +213,15 @@ class WorkersUI::WorkerCreationDestructionListener const WorkerProcessHost::WorkerInstance& instance) OVERRIDE { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&WorkerCreationDestructionListener::NotifyWorkerCreated, - this, base::Owned(BuildWorkerData(process, instance)))); + base::Bind( + &WorkerCreationDestructionListener::NotifyWorkerCreated, + this, base::Owned(BuildWorkerData(process->GetData(), instance)))); } virtual void WorkerDestroyed( WorkerProcessHost* process, int worker_route_id) OVERRIDE { DictionaryValue* worker_data = new DictionaryValue(); - worker_data->SetInteger(kWorkerProcessHostIdField, process->data().id); + worker_data->SetInteger(kWorkerProcessHostIdField, process->GetData().id); worker_data->SetInteger(kWorkerRouteIdField, worker_route_id); BrowserThread::PostTask( diff --git a/chrome/browser/web_resource/web_resource_service.cc b/chrome/browser/web_resource/web_resource_service.cc index 65a6de5..a93fdde 100644 --- a/chrome/browser/web_resource/web_resource_service.cc +++ b/chrome/browser/web_resource/web_resource_service.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/command_line.h" +#include "base/message_loop.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/time.h" |