diff options
-rw-r--r-- | chrome/app/chrome_main.cc | 6 | ||||
-rw-r--r-- | chrome/chrome_common.gypi | 2 | ||||
-rw-r--r-- | chrome/common/chrome_content_client.cc | 18 | ||||
-rw-r--r-- | chrome/common/chrome_content_client.h | 25 | ||||
-rw-r--r-- | chrome/gpu/gpu_thread.cc | 5 | ||||
-rw-r--r-- | content/common/content_client.cc | 19 | ||||
-rw-r--r-- | content/common/content_client.h | 35 | ||||
-rw-r--r-- | content/content_common.gypi | 2 |
8 files changed, 110 insertions, 2 deletions
diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc index 481941f..0156d2a 100644 --- a/chrome/app/chrome_main.cc +++ b/chrome/app/chrome_main.cc @@ -25,6 +25,7 @@ #include "chrome/browser/diagnostics/diagnostics_main.h" #include "chrome/browser/platform_util.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_content_client.h" #include "chrome/common/chrome_counters.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths_internal.h" @@ -37,6 +38,7 @@ #include "chrome/common/set_process_title.h" #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_process_host.h" +#include "content/common/content_client.h" #include "content/common/content_paths.h" #include "ipc/ipc_switches.h" #include "ui/base/resource/resource_bundle.h" @@ -574,6 +576,10 @@ int ChromeMain(int argc, char** argv) { Append(chrome::kHelperProcessExecutablePath)); #endif + // Initialize the content client which that code uses to talk to Chrome. + chrome::ChromeContentClient chrome_content_client; + content::SetContentClient(&chrome_content_client); + // Notice a user data directory override if any FilePath user_data_dir = command_line.GetSwitchValuePath(switches::kUserDataDir); diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index fa8295b..865b4e5 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -217,6 +217,8 @@ 'common/automation_messages_internal.h', 'common/badge_util.cc', 'common/badge_util.h', + 'common/chrome_content_client.cc', + 'common/chrome_content_client.h', 'common/chrome_descriptors.h', 'common/chrome_plugin_api.h', 'common/chrome_plugin_lib.cc', diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc new file mode 100644 index 0000000..eeba233 --- /dev/null +++ b/chrome/common/chrome_content_client.cc @@ -0,0 +1,18 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/chrome_content_client.h" + +#include "chrome/common/child_process_logging.h" + +namespace chrome { + +void ChromeContentClient::SetActiveURL(const GURL& url) { +} + +void ChromeContentClient::SetGpuInfo(const GPUInfo& gpu_info) { + child_process_logging::SetGpuInfo(gpu_info); +} + +} // namespace chrome diff --git a/chrome/common/chrome_content_client.h b/chrome/common/chrome_content_client.h new file mode 100644 index 0000000..8c91fca --- /dev/null +++ b/chrome/common/chrome_content_client.h @@ -0,0 +1,25 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_CHROME_CONTENT_CLIENT_H_ +#define CHROME_COMMON_CHROME_CONTENT_CLIENT_H_ +#pragma once + +#include "content/common/content_client.h" + +namespace chrome { + +class ChromeContentClient : public content::ContentClient { + public: + // Sets the URL that is logged if the child process crashes. Use GURL() to + // clear the URL. + virtual void SetActiveURL(const GURL& url); + + // Sets the data on the gpu to send along with crash reports. + virtual void SetGpuInfo(const GPUInfo& gpu_info); +}; + +} // namespace chrome + +#endif // CHROME_COMMON_CHROME_CONTENT_CLIENT_H_ diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc index 96722bf..706d537 100644 --- a/chrome/gpu/gpu_thread.cc +++ b/chrome/gpu/gpu_thread.cc @@ -13,12 +13,12 @@ #include "base/command_line.h" #include "base/threading/worker_pool.h" #include "build/build_config.h" -#include "chrome/common/child_process_logging.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/gpu_messages.h" #include "chrome/gpu/gpu_info_collector.h" #include "chrome/gpu/gpu_watchdog_thread.h" #include "content/common/child_process.h" +#include "content/common/content_client.h" #include "ipc/ipc_channel_handle.h" #if defined(OS_MACOSX) @@ -134,7 +134,8 @@ void GpuThread::OnInitialize() { gpu_info_.collection_error = true; LOG(ERROR) << "gpu_info_collector::CollectGraphicsInfo() failed"; } - child_process_logging::SetGpuInfo(gpu_info_); + + content::GetContentClient()->SetGpuInfo(gpu_info_); LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo complete"; // Record initialization only after collecting the GPU info because that can diff --git a/content/common/content_client.cc b/content/common/content_client.cc new file mode 100644 index 0000000..6fa7ace --- /dev/null +++ b/content/common/content_client.cc @@ -0,0 +1,19 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/common/content_client.h" + +namespace content { + +static ContentClient* g_client; + +void SetContentClient(ContentClient* client) { + g_client = client; +} + +ContentClient* GetContentClient() { + return g_client; +} + +} // namespace content diff --git a/content/common/content_client.h b/content/common/content_client.h new file mode 100644 index 0000000..8a9b536 --- /dev/null +++ b/content/common/content_client.h @@ -0,0 +1,35 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_COMMON_CONTENT_CLIENT_H_ +#define CONTENT_COMMON_CONTENT_CLIENT_H_ +#pragma once + +#include "base/basictypes.h" + +class GURL; +struct GPUInfo; + +namespace content { + +class ContentClient; +// Setter and getter for the client. The client should be set early, before any +// content code is called. +void SetContentClient(ContentClient* client); +ContentClient* GetContentClient(); + +// Interface that the embedder implements. +class ContentClient { + public: + // Sets the URL that is logged if the child process crashes. Use GURL() to + // clear the URL. + virtual void SetActiveURL(const GURL& url) {} + + // Sets the data on the gpu to send along with crash reports. + virtual void SetGpuInfo(const GPUInfo& gpu_info) {} +}; + +} // namespace content + +#endif // CONTENT_COMMON_CONTENT_CLIENT_H_ diff --git a/content/content_common.gypi b/content/content_common.gypi index 314487e..5a5b49b 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -28,6 +28,8 @@ 'common/common_param_traits.h', 'common/content_message_generator.cc', 'common/content_message_generator.h', + 'common/content_client.cc', + 'common/content_client.h', 'common/content_constants.cc', 'common/content_constants.h', 'common/content_paths.cc', |