Skip to content

Commit

Permalink
Move renderer_main and renderer_glue to content.
Browse files Browse the repository at this point in the history
Review URL: http://codereview.chromium.org/6878002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81962 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jam@chromium.org committed Apr 18, 2011
1 parent 253b073 commit bf2ecb4
Show file tree
Hide file tree
Showing 25 changed files with 128 additions and 133 deletions.
4 changes: 2 additions & 2 deletions chrome/app/chrome_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/chrome_content_plugin_client.h"
#include "chrome/common/chrome_counters.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
Expand All @@ -37,6 +36,7 @@
#include "chrome/renderer/chrome_content_renderer_client.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/common/content_client.h"
#include "content/common/content_counters.h"
#include "content/common/content_paths.h"
#include "content/common/main_function_params.h"
#include "content/common/sandbox_init_wrapper.h"
Expand Down Expand Up @@ -685,7 +685,7 @@ int ChromeMain(int argc, char** argv) {
InitializeStatsTable(browser_pid, command_line);

base::StatsScope<base::StatsCounterTimer>
startup_timer(chrome::Counters::chrome_main());
startup_timer(content::Counters::chrome_main());

// Enable the heap profiler as early as possible!
EnableHeapProfiler(command_line);
Expand Down
2 changes: 0 additions & 2 deletions chrome/chrome_common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
'common/child_process_logging_linux.cc',
'common/child_process_logging_mac.mm',
'common/child_process_logging_win.cc',
'common/chrome_counters.cc',
'common/chrome_counters.h',
'common/chrome_version_info.cc',
'common/chrome_version_info.h',
'common/content_restriction.h',
Expand Down
1 change: 1 addition & 0 deletions chrome/chrome_dll.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@
'../content/common/child_process.cc',
'../content/common/child_thread.cc',
'../content/common/content_client.cc',
'../content/common/content_counters.cc',
'../content/common/content_message_generator.cc',
'../content/common/content_paths.cc',
'../content/common/content_switches.cc',
Expand Down
7 changes: 1 addition & 6 deletions chrome/chrome_renderer.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
'renderer/chrome_render_process_observer.h',
'renderer/chrome_render_view_observer.cc',
'renderer/chrome_render_view_observer.h',
'renderer/chrome_renderer_glue.cc',
'renderer/content_settings_observer.cc',
'renderer/content_settings_observer.h',
'renderer/devtools_agent.cc',
Expand All @@ -124,14 +125,8 @@
'renderer/print_web_view_helper_linux.cc',
'renderer/print_web_view_helper_mac.mm',
'renderer/print_web_view_helper_win.cc',
'renderer/renderer_glue.cc',
'renderer/renderer_histogram_snapshots.cc',
'renderer/renderer_histogram_snapshots.h',
'renderer/renderer_main.cc',
'renderer/renderer_main_platform_delegate.h',
'renderer/renderer_main_platform_delegate_linux.cc',
'renderer/renderer_main_platform_delegate_mac.mm',
'renderer/renderer_main_platform_delegate_win.cc',
# TODO(noelutz): Find a better way to include these files
'<(protoc_out_dir)/chrome/renderer/safe_browsing/client_model.pb.cc',
'<(protoc_out_dir)/chrome/renderer/safe_browsing/client_model.pb.h',
Expand Down
20 changes: 0 additions & 20 deletions chrome/common/chrome_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -553,18 +553,6 @@ const char kForceAppsPromoVisible[] = "force-apps-promo-visible";
// the base layer even when compositing is not strictly required.
const char kForceCompositingMode[] = "force-compositing-mode";

// Some field tests may rendomized in the browser, and the randomly selected
// outcome needs to be propagated to the renderer. For instance, this is used
// to modify histograms recorded in the renderer, or to get the renderer to
// also set of its state (initialize, or not initialize components) to match the
// experiment(s).
// The argument is a string-ized list of experiment names, and the associated
// value that was randomly selected. In the recent implementetaion, the
// persistent representation generated by field_trial.cc and later decoded, is a
// list of name and value pairs, separated by slashes. See field trial.cc for
// current details.
const char kForceFieldTestNameAndValue[] = "force-fieldtest";

// Force renderer accessibility to be on instead of enabling it on demand when
// a screen reader is detected. The disable-renderer-accessibility switch
// overrides this if present.
Expand Down Expand Up @@ -823,14 +811,6 @@ const char kRemoteDebuggingPort[] = "remote-debugging-port";
// Enable remote debug / automation shell on the specified port.
const char kRemoteShellPort[] = "remote-shell-port";

// Causes the renderer process to throw an assertion on launch.
const char kRendererAssertTest[] = "renderer-assert-test";

#if !defined(OFFICIAL_BUILD)
// Causes the renderer process to throw an assertion on launch.
const char kRendererCheckFalseTest[] = "renderer-check-false-test";
#endif

// Indicates the last session should be restored on startup. This overrides
// the preferences value and is primarily intended for testing. The value of
// this switch is the number of tabs to wait until loaded before
Expand Down
6 changes: 0 additions & 6 deletions chrome/common/chrome_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ extern const char kFocusExistingTabOnOpen[];
extern const char kFirstRun[];
extern const char kForceAppsPromoVisible[];
extern const char kForceCompositingMode[];
extern const char kForceFieldTestNameAndValue[];
extern const char kForceRendererAccessibility[];
extern const char kForceStubLibcros[];
extern const char kGSSAPILibraryName[];
Expand Down Expand Up @@ -230,7 +229,6 @@ extern const char kPurgeMemoryButton[];
extern const char kReloadKilledTabs[];
extern const char kRemoteDebuggingPort[];
extern const char kRemoteShellPort[];
extern const char kRendererAssertTest[];
extern const char kRestoreLastSession[];
extern const char kSbInfoURLPrefix[];
extern const char kSbMacKeyURLPrefix[];
Expand Down Expand Up @@ -341,10 +339,6 @@ extern const char kWebSocketLiveExperimentHost[];
extern const char kExposePrivateExtensionApi[];
#endif

#if !defined(OFFICIAL_BUILD)
extern const char kRendererCheckFalseTest[];
#endif

#if defined(HAVE_XINPUT2)
extern const char kTouchDevices[];
#endif
Expand Down
1 change: 0 additions & 1 deletion chrome/renderer/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ include_rules = [
"+webkit/plugins",
"+v8/include",
"+third_party/cld/encodings/compact_lang_det/win",
"+third_party/mach_override",
"+third_party/npapi/bindings",
"+third_party/sqlite",
]
Expand Down
6 changes: 5 additions & 1 deletion chrome/renderer/chrome_render_process_observer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
#include "base/process_util.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/net/net_resource_provider.h"
#include "chrome/common/render_messages.h"
#include "chrome/renderer/content_settings_observer.h"
#include "content/common/view_messages.h"
#include "content/renderer/render_thread.h"
#include "content/renderer/render_view.h"
#include "content/renderer/render_view_visitor.h"
#include "crypto/nss_util.h"
#include "net/base/net_module.h"
#include "third_party/sqlite/sqlite3.h"
#include "third_party/tcmalloc/chromium/src/google/malloc_extension.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h"
Expand All @@ -26,7 +28,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "v8/include/v8.h"

#if defined(OS_WIN)
#include "app/win/iat_patch_function.h"
#endif
Expand Down Expand Up @@ -113,6 +114,9 @@ ChromeRenderProcessObserver::ChromeRenderProcessObserver() {
base::StatisticsRecorder::set_dump_on_exit(true);
}

// Configure modules that need access to resources.
net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider);

#if defined(OS_WIN)
// Need to patch a few functions for font loading to work correctly.
FilePath pdf;
Expand Down
58 changes: 58 additions & 0 deletions chrome/renderer/chrome_renderer_glue.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// 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.

// This file provides the Chrome-specific embedder's side of random webkit glue
// functions.

#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/render_messages.h"
#include "content/renderer/render_thread.h"
#include "webkit/glue/webkit_glue.h"

#if !defined(DISABLE_NACL)
#include "native_client/src/shared/imc/nacl_imc.h"
#include "native_client/src/trusted/plugin/nacl_entry_points.h"
#endif

namespace webkit_glue {

void UserMetricsRecordAction(const std::string& action) {
RenderThread::current()->Send(
new ViewHostMsg_UserMetricsRecordAction(action));
}

std::string GetProductVersion() {
chrome::VersionInfo version_info;
std::string product("Chrome/");
product += version_info.is_valid() ? version_info.Version()
: "0.0.0.0";
return product;
}

#if !defined(DISABLE_NACL)
bool LaunchSelLdr(const char* alleged_url, int socket_count, void* imc_handles,
void* nacl_process_handle, int* nacl_process_id) {
std::vector<nacl::FileDescriptor> sockets;
base::ProcessHandle nacl_process;
if (!RenderThread::current()->Send(
new ViewHostMsg_LaunchNaCl(
ASCIIToWide(alleged_url),
socket_count,
&sockets,
&nacl_process,
reinterpret_cast<base::ProcessId*>(nacl_process_id)))) {
return false;
}
CHECK(static_cast<int>(sockets.size()) == socket_count);
for (int i = 0; i < socket_count; i++) {
static_cast<nacl::Handle*>(imc_handles)[i] =
nacl::ToNativeHandle(sockets[i]);
}
*static_cast<nacl::Handle*>(nacl_process_handle) = nacl_process;
return true;
}
#endif

} // namespace webkit_glue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "base/shared_memory.h"
#include "chrome/common/render_messages.h"
#include "chrome/renderer/mock_render_process.h"
#include "chrome/renderer/renderer_main_platform_delegate.h"
#include "content/common/dom_storage_common.h"
#include "content/common/main_function_params.h"
#include "content/common/resource_messages.h"
Expand All @@ -20,6 +19,7 @@
#include "content/common/view_messages.h"
#include "content/renderer/render_thread.h"
#include "content/renderer/render_view.h"
#include "content/renderer/renderer_main_platform_delegate.h"
#include "googleurl/src/gurl.h"
#include "net/base/upload_data.h"
#include "net/http/http_response_headers.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/test/render_view_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#include "chrome/renderer/extensions/js_only_v8_extensions.h"
#include "chrome/renderer/extensions/renderer_extension_bindings.h"
#include "chrome/renderer/mock_render_process.h"
#include "chrome/renderer/renderer_main_platform_delegate.h"
#include "content/common/dom_storage_common.h"
#include "content/common/native_web_keyboard_event.h"
#include "content/common/renderer_preferences.h"
#include "content/common/view_messages.h"
#include "content/renderer/renderer_main_platform_delegate.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/test/render_view_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "chrome/renderer/autofill/autofill_agent.h"
#include "chrome/renderer/mock_keyboard.h"
#include "chrome/renderer/mock_render_thread.h"
#include "chrome/renderer/renderer_main_platform_delegate.h"
#include "content/common/main_function_params.h"
#include "content/common/native_web_keyboard_event.h"
#include "content/common/sandbox_init_wrapper.h"
Expand All @@ -31,6 +30,7 @@ class PasswordAutofillManager;

class ExtensionDispatcher;
class MockRenderProcess;
class RendererMainPlatformDelegate;

class RenderViewTest : public testing::Test {
public:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// 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_counters.h"
#include "content/common/content_counters.h"

#include "base/metrics/stats_counters.h"

namespace chrome {
namespace content {

using base::StatsCounterTimer;
using base::StatsRate;
Expand All @@ -32,14 +32,4 @@ StatsCounterTimer& Counters::renderer_main() {
return *ctr;
}

StatsCounterTimer& Counters::spellcheck_init() {
static StatsCounterTimer* ctr = new StatsCounterTimer("SpellCheck.Init");
return *ctr;
}

StatsRate& Counters::spellcheck_lookup() {
static StatsRate* ctr = new StatsRate("SpellCheck.Lookup");
return *ctr;
}

} // namespace chrome
} // namespace content
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// 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.

// Counters used within the browser.

#ifndef CHROME_COMMON_CHROME_COUNTERS_H_
#define CHROME_COMMON_CHROME_COUNTERS_H_
#ifndef CONTENT_COMMON_CONTENT_COUNTERS_H_
#define CONTENT_COMMON_CONTENT_COUNTERS_H_
#pragma once

namespace base {
Expand All @@ -14,7 +14,7 @@ class StatsCounterTimer;
class StatsRate;
}

namespace chrome {
namespace content {

class Counters {
public:
Expand All @@ -23,14 +23,8 @@ class Counters {

// The amount of time spent in renderer initialization.
static base::StatsCounterTimer& renderer_main();

// Time spent in spellchecker initialization.
static base::StatsCounterTimer& spellcheck_init();

// Time/Count of spellcheck lookups.
static base::StatsRate& spellcheck_lookup();
};

} // namespace chrome
} // namespace content

#endif // CHROME_COMMON_CHROME_COUNTERS_H_
#endif // CONTENT_COMMON_CONTENT_COUNTERS_H_
21 changes: 21 additions & 0 deletions content/common/content_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ const char kExtraPluginDir[] = "extra-plugin-dir";
// Causes the process to run as an extension subprocess.
const char kExtensionProcess[] = "extension";

// Some field tests may rendomized in the browser, and the randomly selected
// outcome needs to be propagated to the renderer. For instance, this is used
// to modify histograms recorded in the renderer, or to get the renderer to
// also set of its state (initialize, or not initialize components) to match the
// experiment(s).
// The argument is a string-ized list of experiment names, and the associated
// value that was randomly selected. In the recent implementetaion, the
// persistent representation generated by field_trial.cc and later decoded, is a
// list of name and value pairs, separated by slashes. See field trial.cc for
// current details.
const char kForceFieldTestNameAndValue[] = "force-fieldtest";

// Extra command line options for launching the GPU process (normally used
// for debugging). Use like renderer-cmd-prefix.
const char kGpuLauncher[] = "gpu-launcher";
Expand Down Expand Up @@ -302,6 +314,9 @@ const char kProfileImportProcess[] = "profile-import";
// Register Pepper plugins (see pepper_plugin_registry.cc for its format).
const char kRegisterPepperPlugins[] = "register-pepper-plugins";

// Causes the renderer process to throw an assertion on launch.
const char kRendererAssertTest[] = "renderer-assert-test";

// On POSIX only: the contents of this flag are prepended to the renderer
// command line. Useful values might be "valgrind" or "xterm -e gdb --args".
const char kRendererCmdPrefix[] = "renderer-cmd-prefix";
Expand Down Expand Up @@ -380,4 +395,10 @@ const char kZygoteCmdPrefix[] = "zygote-cmd-prefix";

// Causes the process to run as a renderer zygote.
const char kZygoteProcess[] = "zygote";

#if !defined(OFFICIAL_BUILD)
// Causes the renderer process to throw an assertion on launch.
const char kRendererCheckFalseTest[] = "renderer-check-false-test";
#endif

} // namespace switches
Loading

0 comments on commit bf2ecb4

Please sign in to comment.