summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-18 19:26:37 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-18 19:26:37 +0000
commitf45c5f3d74273e913c62598fcbde35e20924ab50 (patch)
tree6364e206042679e527802f2214132138a731e826
parent55410d7379f605f828d9845ee1ae8f62c0b0b145 (diff)
downloadchromium_src-f45c5f3d74273e913c62598fcbde35e20924ab50.zip
chromium_src-f45c5f3d74273e913c62598fcbde35e20924ab50.tar.gz
chromium_src-f45c5f3d74273e913c62598fcbde35e20924ab50.tar.bz2
Cleanup of v8 extension stuff. Playback extension is only used in chrome, so move it to chrome\renderer and all of its associated switches to chrome. GC extension is only used by webkit\support, so move it there. The other two profiler extensions aren't used, so remove them.
Review URL: https://chromiumcodereview.appspot.com/10117022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132841 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chrome_content_browser_client.cc3
-rw-r--r--chrome/chrome_renderer.gypi2
-rw-r--r--chrome/common/chrome_switches.cc17
-rw-r--r--chrome/common/chrome_switches.h3
-rw-r--r--chrome/renderer/chrome_content_renderer_client.cc14
-rw-r--r--chrome/renderer/playback_extension.cc (renamed from webkit/extensions/v8/playback_extension.cc)2
-rw-r--r--chrome/renderer/playback_extension.h (renamed from webkit/extensions/v8/playback_extension.h)10
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc3
-rw-r--r--content/public/common/content_switches.cc17
-rw-r--r--content/public/common/content_switches.h3
-rw-r--r--content/renderer/render_thread_impl.cc7
-rw-r--r--webkit/extensions/v8/OWNERS1
-rw-r--r--webkit/extensions/v8/heap_profiler_extension.cc112
-rw-r--r--webkit/extensions/v8/heap_profiler_extension.h26
-rw-r--r--webkit/extensions/v8/profiler_extension.cc104
-rw-r--r--webkit/extensions/v8/profiler_extension.h27
-rw-r--r--webkit/extensions/webkit_extensions_export.h26
-rw-r--r--webkit/glue/webkit_glue.gypi13
-rw-r--r--webkit/support/gc_extension.cc (renamed from webkit/extensions/v8/gc_extension.cc)2
-rw-r--r--webkit/support/gc_extension.h (renamed from webkit/extensions/v8/gc_extension.h)10
-rw-r--r--webkit/support/test_webkit_platform_support.cc2
-rw-r--r--webkit/support/webkit_support.gypi2
-rw-r--r--webkit/tools/test_shell/node_leak_test.cc6
-rw-r--r--webkit/tools/test_shell/test_shell_main.cc55
-rw-r--r--webkit/tools/test_shell/test_shell_switches.cc15
-rw-r--r--webkit/tools/test_shell/test_shell_switches.h5
26 files changed, 49 insertions, 438 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 707ca7a..ee71f09 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -770,7 +770,9 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kExperimentalSpellcheckerFeatures,
switches::kMemoryProfiling,
switches::kMessageLoopHistogrammer,
+ switches::kNoJsRandomness,
switches::kNoRunningInsecureContent,
+ switches::kPlaybackMode,
switches::kPpapiFlashArgs,
switches::kPpapiFlashInProcess,
switches::kPpapiFlashPath,
@@ -778,6 +780,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kProfilingAtStart,
switches::kProfilingFile,
switches::kProfilingFlush,
+ switches::kRecordMode,
switches::kSilentDumpOnDCHECK,
switches::kWhitelistedExtensionID,
};
diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi
index f9ce51d..99bd387 100644
--- a/chrome/chrome_renderer.gypi
+++ b/chrome/chrome_renderer.gypi
@@ -131,6 +131,8 @@
'renderer/net/predictor_queue.h',
'renderer/net/renderer_net_predictor.cc',
'renderer/net/renderer_net_predictor.h',
+ 'renderer/playback_extension.cc',
+ 'renderer/playback_extension.h',
'renderer/resource_bundle_source_map.cc',
'renderer/resource_bundle_source_map.h',
'renderer/resources/extensions/apitest.js',
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 51b273b..bffa62f 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -854,6 +854,13 @@ const char kNoExperiments[] = "no-experiments";
// you're for some reason tempted to pass them both.
const char kNoFirstRun[] = "no-first-run";
+// Support a separate switch that enables the v8 playback extension.
+// The extension causes javascript calls to Date.now() and Math.random()
+// to return consistent values, such that subsequent loads of the same
+// page will result in consistent js-generated data and XHR requests.
+// Pages may still be able to generate inconsistent data from plugins.
+const char kNoJsRandomness[] = "no-js-randomness";
+
// Starts the browser outside of managed mode.
const char kNoManaged[] = "no-managed";
@@ -937,6 +944,10 @@ const char kPackExtensionKey[] = "pack-extension-key";
// Specifies the path to the user data folder for the parent profile.
const char kParentProfile[] = "parent-profile";
+// Read previously recorded data from the cache. Only cached data is read.
+// See kRecordMode.
+const char kPlaybackMode[] = "playback-mode";
+
// Controls the PPAPI Flash field trial. Valid values are defined below. If an
// unknown value is supplied on the command line, the switch is ignored.
// TODO(yzshen): Remove this flag when the field trial is over.
@@ -1040,6 +1051,12 @@ const char kProxyServer[] = "proxy-server";
// NOTE: This is only implemented for Views.
const char kPurgeMemoryButton[] = "purge-memory-button";
+// Chrome supports a playback and record mode. Record mode saves *everything*
+// to the cache. Playback mode reads data exclusively from the cache. This
+// allows us to record a session into the cache and then replay it at will.
+// See also kPlaybackMode.
+const char kRecordMode[] = "record-mode";
+
// Reloads pages that have been killed when they are next focused by the user.
const char kReloadKilledTabs[] = "reload-killed-tabs";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index abe4977..f00f873 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -232,6 +232,7 @@ extern const char kNoDisplayingInsecureContent[];
extern const char kNoEvents[];
extern const char kNoExperiments[];
extern const char kNoFirstRun[];
+extern const char kNoJsRandomness[];
extern const char kNoManaged[];
extern const char kNoProxyServer[];
extern const char kNoPings[];
@@ -255,6 +256,7 @@ extern const char kOrganicInstall[];
extern const char kPackExtension[];
extern const char kPackExtensionKey[];
extern const char kParentProfile[];
+extern const char kPlaybackMode[];
extern const char kPpapiFlashFieldTrial[];
extern const char kPpapiFlashFieldTrialDisableByDefault[];
extern const char kPpapiFlashFieldTrialEnableByDefault[];
@@ -282,6 +284,7 @@ extern const char kProxyBypassList[];
extern const char kProxyPacUrl[];
extern const char kProxyServer[];
extern const char kPurgeMemoryButton[];
+extern const char kRecordMode[];
extern const char kReloadKilledTabs[];
extern const char kRemoteDebuggingFrontend[];
extern const char kRendererPrintPreview[];
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 9b9fb6c..cd7a2e9 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -47,6 +47,7 @@
#include "chrome/renderer/net/renderer_net_predictor.h"
#include "chrome/renderer/page_click_tracker.h"
#include "chrome/renderer/page_load_histograms.h"
+#include "chrome/renderer/playback_extension.h"
#include "chrome/renderer/plugins/plugin_placeholder.h"
#include "chrome/renderer/plugins/plugin_uma.h"
#include "chrome/renderer/prerender/prerender_dispatcher.h"
@@ -179,12 +180,17 @@ void ChromeContentRendererClient::RenderThreadStarted() {
if (search_extension)
thread->RegisterExtension(search_extension);
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableBenchmarking))
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kEnableBenchmarking))
thread->RegisterExtension(extensions_v8::BenchmarkingExtension::Get());
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableIPCFuzzing)) {
+ if (command_line->HasSwitch(switches::kPlaybackMode) ||
+ command_line->HasSwitch(switches::kRecordMode) ||
+ command_line->HasSwitch(switches::kNoJsRandomness)) {
+ thread->RegisterExtension(extensions_v8::PlaybackExtension::Get());
+ }
+
+ if (command_line->HasSwitch(switches::kEnableIPCFuzzing)) {
thread->GetChannel()->set_outgoing_message_filter(LoadExternalIPCFuzzer());
}
// chrome:, chrome-devtools:, and chrome-internal: pages should not be
diff --git a/webkit/extensions/v8/playback_extension.cc b/chrome/renderer/playback_extension.cc
index c106c84..5f9f017 100644
--- a/webkit/extensions/v8/playback_extension.cc
+++ b/chrome/renderer/playback_extension.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/extensions/v8/playback_extension.h"
+#include "chrome/renderer/playback_extension.h"
#include "v8/include/v8.h"
diff --git a/webkit/extensions/v8/playback_extension.h b/chrome/renderer/playback_extension.h
index c425ea0..6d2a427 100644
--- a/webkit/extensions/v8/playback_extension.h
+++ b/chrome/renderer/playback_extension.h
@@ -2,12 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef WEBKIT_EXTENSIONS_V8_PLAYBACK_EXTENSION_H_
-#define WEBKIT_EXTENSIONS_V8_PLAYBACK_EXTENSION_H_
+#ifndef CHROME_RENDERER_PLAYBACK_EXTENSION_H_
+#define CHROME_RENDERER_PLAYBACK_EXTENSION_H_
#pragma once
-#include "webkit/extensions/webkit_extensions_export.h"
-
namespace v8 {
class Extension;
}
@@ -27,9 +25,9 @@ namespace extensions_v8 {
// in exactly the same order in which they were recorded.
class PlaybackExtension {
public:
- WEBKIT_EXTENSIONS_EXPORT static v8::Extension* Get();
+ static v8::Extension* Get();
};
} // namespace extensions_v8
-#endif // WEBKIT_EXTENSIONS_V8_PLAYBACK_EXTENSION_H_
+#endif // CHROME_RENDERER_PLAYBACK_EXTENSION_H_
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 623d051..f621e7e 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -717,12 +717,9 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kInProcessWebGL,
switches::kJavaScriptFlags,
switches::kLoggingLevel,
- switches::kNoJsRandomness,
switches::kNoReferrers,
switches::kNoSandbox,
- switches::kPlaybackMode,
switches::kPpapiOutOfProcess,
- switches::kRecordMode,
switches::kRegisterPepperPlugins,
switches::kRendererAssertTest,
#if defined(OS_POSIX)
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index d25ab40..b052176 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -421,23 +421,12 @@ const char kNaClBrokerProcess[] = "nacl-broker";
// Causes the process to run as a NativeClient loader.
const char kNaClLoaderProcess[] = "nacl-loader";
-// Support a separate switch that enables the v8 playback extension.
-// The extension causes javascript calls to Date.now() and Math.random()
-// to return consistent values, such that subsequent loads of the same
-// page will result in consistent js-generated data and XHR requests.
-// Pages may still be able to generate inconsistent data from plugins.
-const char kNoJsRandomness[] = "no-js-randomness";
-
// Don't send HTTP-Referer headers.
const char kNoReferrers[] = "no-referrers";
// Disables the sandbox for all process types that are normally sandboxed.
const char kNoSandbox[] = "no-sandbox";
-// Read previously recorded data from the cache. Only cached data is read.
-// See kRecordMode.
-const char kPlaybackMode[] = "playback-mode";
-
// Specifies a command that should be used to launch the plugin process. Useful
// for running the plugin process through purify or quantify. Ex:
// --plugin-launcher="path\to\purify /Run=yes"
@@ -490,12 +479,6 @@ const char kProcessPerSite[] = "process-per-site";
// script connections to each other).
const char kProcessPerTab[] = "process-per-tab";
-// Chrome supports a playback and record mode. Record mode saves *everything*
-// to the cache. Playback mode reads data exclusively from the cache. This
-// allows us to record a session into the cache and then replay it at will.
-// See also kPlaybackMode.
-const char kRecordMode[] = "record-mode";
-
// The value of this switch determines whether the process is started as a
// renderer or plugin host. If it's empty, it's the browser.
const char kProcessType[] = "type";
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h
index 79051a42..f2f4085 100644
--- a/content/public/common/content_switches.h
+++ b/content/public/common/content_switches.h
@@ -132,10 +132,8 @@ extern const char kLogPluginMessages[];
// TODO(jam): this doesn't belong in content.
CONTENT_EXPORT extern const char kNaClBrokerProcess[];
CONTENT_EXPORT extern const char kNaClLoaderProcess[];
-extern const char kNoJsRandomness[];
CONTENT_EXPORT extern const char kNoReferrers[];
CONTENT_EXPORT extern const char kNoSandbox[];
-CONTENT_EXPORT extern const char kPlaybackMode[];
extern const char kPluginLauncher[];
CONTENT_EXPORT extern const char kPluginPath[];
CONTENT_EXPORT extern const char kPluginProcess[];
@@ -151,7 +149,6 @@ extern const char kPpapiStartupDialog[];
extern const char kProcessPerSite[];
CONTENT_EXPORT extern const char kProcessPerTab[];
CONTENT_EXPORT extern const char kProcessType[];
-CONTENT_EXPORT extern const char kRecordMode[];
CONTENT_EXPORT extern const char kRegisterPepperPlugins[];
CONTENT_EXPORT extern const char kRemoteDebuggingPort[];
CONTENT_EXPORT extern const char kRendererAssertTest[];
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 41132b0..f493cc2 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -79,7 +79,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "ui/base/ui_base_switches.h"
#include "v8/include/v8.h"
-#include "webkit/extensions/v8/playback_extension.h"
#include "webkit/glue/webkit_glue.h"
// TODO(port)
@@ -483,12 +482,6 @@ void RenderThreadImpl::EnsureWebKitInitialized() {
webkit_glue::EnableWebCoreLogChannels(
command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels));
- if (command_line.HasSwitch(switches::kPlaybackMode) ||
- command_line.HasSwitch(switches::kRecordMode) ||
- command_line.HasSwitch(switches::kNoJsRandomness)) {
- RegisterExtension(extensions_v8::PlaybackExtension::Get());
- }
-
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDomAutomationController)) {
base::StringPiece extension = content::GetContentClient()->GetDataResource(
diff --git a/webkit/extensions/v8/OWNERS b/webkit/extensions/v8/OWNERS
deleted file mode 100644
index 30288836..0000000
--- a/webkit/extensions/v8/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-mbelshe@chromium.org
diff --git a/webkit/extensions/v8/heap_profiler_extension.cc b/webkit/extensions/v8/heap_profiler_extension.cc
deleted file mode 100644
index 17f9110..0000000
--- a/webkit/extensions/v8/heap_profiler_extension.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-// 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 "webkit/extensions/v8/heap_profiler_extension.h"
-
-#include "base/basictypes.h"
-#include "v8/include/v8.h"
-
-#if defined(USE_TCMALLOC) && !defined(OS_WIN)
-#include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
-#endif
-
-namespace extensions_v8 {
-
-namespace {
-
-const char kHeapProfilerExtensionName[] = "v8/HeapProfiler";
-
-class HeapProfilerWrapper : public v8::Extension {
- public:
- HeapProfilerWrapper()
- : v8::Extension(kHeapProfilerExtensionName,
- "if (typeof(chromium) == 'undefined') {"
- " chromium = {};"
- "}"
- "(function() {"
- " native function HeapProfilerStart();"
- " native function HeapProfilerStop();"
- " native function HeapProfilerDump();"
- " chromium.HeapProfiler = {};"
- " chromium.HeapProfiler.start = function(opt_prefix) {"
- " var prefix = opt_prefix;"
- " if (!prefix) {"
- " var d = new Date();"
- " prefix = \"chromium-\" + "
- " (1900 + d.getYear()) + "
- " \"-\" + d.getMonth() + "
- " \"-\" + d.getDay() + "
- " \"-\" + d.getTime();"
- " }"
- " HeapProfilerStart(prefix);"
- " };"
- " chromium.HeapProfiler.stop = function() {"
- " HeapProfilerStop();"
- " };"
- " chromium.HeapProfiler.dump = function(opt_reason) {"
- " HeapProfilerDump(opt_reason || \"\");"
- " };"
- "})();") {}
-
- virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
- v8::Handle<v8::String> name) {
- if (name->Equals(v8::String::New("HeapProfilerStart"))) {
- return v8::FunctionTemplate::New(HeapProfilerStart);
- } else if (name->Equals(v8::String::New("HeapProfilerStop"))) {
- return v8::FunctionTemplate::New(HeapProfilerStop);
- } else if (name->Equals(v8::String::New("HeapProfilerDump"))) {
- return v8::FunctionTemplate::New(HeapProfilerDump);
- }
- return v8::Handle<v8::FunctionTemplate>();
- }
-
-#if defined(USE_TCMALLOC) && !defined(OS_WIN)
- static v8::Handle<v8::Value> HeapProfilerStart(const v8::Arguments& args) {
- if (args.Length() >= 1 && args[0]->IsString()) {
- v8::Local<v8::String> js_prefix = args[0]->ToString();
- char prefix[256];
- js_prefix->WriteAscii(prefix, 0, arraysize(prefix) - 1);
- ::HeapProfilerStart(prefix);
- }
- return v8::Undefined();
- }
-
- static v8::Handle<v8::Value> HeapProfilerStop(const v8::Arguments& args) {
- ::HeapProfilerStop();
- return v8::Undefined();
- }
-
- static v8::Handle<v8::Value> HeapProfilerDump(const v8::Arguments& args) {
- if (args.Length() >= 1 && args[0]->IsString()) {
- v8::Local<v8::String> js_reason = args[0]->ToString();
- char reason[256];
- js_reason->WriteAscii(reason, 0, arraysize(reason) - 1);
- ::HeapProfilerDump(reason);
- }
- return v8::Undefined();
- }
-
-#else
-
- static v8::Handle<v8::Value> HeapProfilerStart(const v8::Arguments& args) {
- return v8::Undefined();
- }
-
- static v8::Handle<v8::Value> HeapProfilerStop(const v8::Arguments& args) {
- return v8::Undefined();
- }
-
- static v8::Handle<v8::Value> HeapProfilerDump(const v8::Arguments& args) {
- return v8::Undefined();
- }
-#endif
-};
-
-} // namespace
-
-v8::Extension* HeapProfilerExtension::Get() {
- return new HeapProfilerWrapper;
-}
-
-} // namespace extensions_v8
diff --git a/webkit/extensions/v8/heap_profiler_extension.h b/webkit/extensions/v8/heap_profiler_extension.h
deleted file mode 100644
index 6e28b20..0000000
--- a/webkit/extensions/v8/heap_profiler_extension.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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 WEBKIT_EXTENSIONS_V8_HEAP_PROFILER_EXTENSION_H_
-#define WEBKIT_EXTENSIONS_V8_HEAP_PROFILER_EXTENSION_H_
-#pragma once
-
-#include "webkit/extensions/webkit_extensions_export.h"
-
-namespace v8 {
-class Extension;
-}
-
-namespace extensions_v8 {
-
-// HeapProfilerExtension is a V8 extension to expose a JS function for
-// dumping native heap profiles. This should only be used for debugging.
-class HeapProfilerExtension {
- public:
- WEBKIT_EXTENSIONS_EXPORT static v8::Extension* Get();
-};
-
-} // namespace extensions_v8
-
-#endif // WEBKIT_EXTENSIONS_V8_HEAP_PROFILER_EXTENSION_H_
diff --git a/webkit/extensions/v8/profiler_extension.cc b/webkit/extensions/v8/profiler_extension.cc
deleted file mode 100644
index 3ffc205..0000000
--- a/webkit/extensions/v8/profiler_extension.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-// 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 "webkit/extensions/v8/profiler_extension.h"
-
-#include "build/build_config.h"
-#include "v8/include/v8.h"
-
-#if defined(USE_TCMALLOC) && defined(OS_POSIX) && !defined(OS_MACOSX)
-#include "third_party/tcmalloc/chromium/src/gperftools/profiler.h"
-#endif
-
-const char kProfilerExtensionName[] = "v8/Profiler";
-
-namespace extensions_v8 {
-
-class ProfilerWrapper : public v8::Extension {
- public:
- ProfilerWrapper() :
- v8::Extension(kProfilerExtensionName,
- "if (typeof(chromium) == 'undefined') {"
- " chromium = {};"
- "}"
- "chromium.Profiler = function() {"
- " native function ProfilerStart();"
- " native function ProfilerStop();"
- " native function ProfilerFlush();"
- " native function ProfilerClearData();"
- " native function ProfilerSetThreadName();"
- " this.start = function() {"
- " ProfilerStart();"
- " };"
- " this.stop = function() {"
- " ProfilerStop();"
- " };"
- " this.clear = function() {"
- " ProfilerClearData();"
- " };"
- " this.flush = function() {"
- " ProfilerFlush();"
- " };"
- " this.setThreadName = function(name) {"
- " ProfilerSetThreadName(name);"
- " };"
- "};") {}
-
- virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
- v8::Handle<v8::String> name) {
- if (name->Equals(v8::String::New("ProfilerStart")))
- return v8::FunctionTemplate::New(ProfilerStart);
- else if (name->Equals(v8::String::New("ProfilerStop")))
- return v8::FunctionTemplate::New(ProfilerStop);
- else if (name->Equals(v8::String::New("ProfilerClearData")))
- return v8::FunctionTemplate::New(ProfilerClearData);
- else if (name->Equals(v8::String::New("ProfilerFlush")))
- return v8::FunctionTemplate::New(ProfilerFlush);
- else if (name->Equals(v8::String::New("ProfilerSetThreadName")))
- return v8::FunctionTemplate::New(ProfilerSetThreadName);
-
- return v8::Handle<v8::FunctionTemplate>();
- }
-
- static v8::Handle<v8::Value> ProfilerStart(const v8::Arguments& args) {
-#if defined(USE_TCMALLOC) && defined(OS_POSIX) && !defined(OS_MACOSX)
- ::ProfilerStart("chrome-profile");
-#endif
- return v8::Undefined();
- }
-
- static v8::Handle<v8::Value> ProfilerStop(const v8::Arguments& args) {
-#if defined(USE_TCMALLOC) && defined(OS_POSIX) && !defined(OS_MACOSX)
- ::ProfilerStop();
-#endif
- return v8::Undefined();
- }
-
- static v8::Handle<v8::Value> ProfilerClearData(const v8::Arguments& args) {
- return v8::Undefined();
- }
-
- static v8::Handle<v8::Value> ProfilerFlush(const v8::Arguments& args) {
-#if defined(USE_TCMALLOC) && defined(OS_POSIX) && !defined(OS_MACOSX)
- ::ProfilerFlush();
-#endif
- return v8::Undefined();
- }
-
- static v8::Handle<v8::Value> ProfilerSetThreadName(
- const v8::Arguments& args) {
- if (args.Length() >= 1 && args[0]->IsString()) {
- v8::Local<v8::String> inputString = args[0]->ToString();
- char nameBuffer[256];
- inputString->WriteAscii(nameBuffer, 0, sizeof(nameBuffer)-1);
- }
- return v8::Undefined();
- }
-};
-
-v8::Extension* ProfilerExtension::Get() {
- return new ProfilerWrapper();
-}
-
-} // namespace extensions_v8
diff --git a/webkit/extensions/v8/profiler_extension.h b/webkit/extensions/v8/profiler_extension.h
deleted file mode 100644
index 8098cb7..0000000
--- a/webkit/extensions/v8/profiler_extension.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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 WEBKIT_EXTENSIONS_V8_PROFILER_EXTENSION_H_
-#define WEBKIT_EXTENSIONS_V8_PROFILER_EXTENSION_H_
-#pragma once
-
-#include "webkit/extensions/webkit_extensions_export.h"
-
-namespace v8 {
-class Extension;
-}
-
-namespace extensions_v8 {
-
-// Profiler is an extension to allow javascript access to the API for
-// an external profiler program (such as Quantify). The "External" part of the
-// name is to distinguish it from the built-in V8 Profiler.
-class ProfilerExtension {
- public:
- WEBKIT_EXTENSIONS_EXPORT static v8::Extension* Get();
-};
-
-} // namespace extensions_v8
-
-#endif // WEBKIT_EXTENSIONS_V8_PROFILER_EXTENSION_H_
diff --git a/webkit/extensions/webkit_extensions_export.h b/webkit/extensions/webkit_extensions_export.h
deleted file mode 100644
index f1fff8e..0000000
--- a/webkit/extensions/webkit_extensions_export.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2012 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 WEBKIT_EXTENSIONS_WEBKIT_EXTENSIONS_EXPORT_H_
-#define WEBKIT_EXTENSIONS_WEBKIT_EXTENSIONS_EXPORT_H_
-#pragma once
-
-#if defined(COMPONENT_BUILD)
-#if defined(WIN32)
-
-#if defined(WEBKIT_EXTENSIONS_IMPLEMENTATION)
-#define WEBKIT_EXTENSIONS_EXPORT __declspec(dllexport)
-#else
-#define WEBKIT_EXTENSIONS_EXPORT __declspec(dllimport)
-#endif // defined(WEBKIT_EXTENSIONS_IMPLEMENTATION)
-
-#else // defined(WIN32)
-#define WEBKIT_EXTENSIONS_EXPORT __attribute__((visibility("default")))
-#endif
-
-#else // defined(COMPONENT_BUILD)
-#define WEBKIT_EXTENSIONS_EXPORT
-#endif
-
-#endif // WEBKIT_EXTENSIONS_WEBKIT_EXTENSIONS_EXPORT_H_
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index 89bc7bd..a3d6ed5 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -455,19 +455,6 @@
'window_open_disposition.cc',
'worker_task_runner.cc',
'worker_task_runner.h',
-
- # These files used to be built in the webcore target, but moved here
- # since part of glue.
- '../extensions/v8/gc_extension.cc',
- '../extensions/v8/gc_extension.h',
- '../extensions/v8/heap_profiler_extension.cc',
- '../extensions/v8/heap_profiler_extension.h',
- '../extensions/v8/playback_extension.cc',
- '../extensions/v8/playback_extension.h',
- '../extensions/v8/profiler_extension.cc',
- '../extensions/v8/profiler_extension.h',
- '../extensions/webkit_extensions_export.h',
-
],
# When glue is a dependency, it needs to be a hard dependency.
# Dependents may rely on files generated by this target or one of its
diff --git a/webkit/extensions/v8/gc_extension.cc b/webkit/support/gc_extension.cc
index d8aa9f7..44c3e11 100644
--- a/webkit/extensions/v8/gc_extension.cc
+++ b/webkit/support/gc_extension.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/extensions/v8/gc_extension.h"
+#include "webkit/support/gc_extension.h"
#include "v8/include/v8.h"
diff --git a/webkit/extensions/v8/gc_extension.h b/webkit/support/gc_extension.h
index ea5003b..ef3f2bd 100644
--- a/webkit/extensions/v8/gc_extension.h
+++ b/webkit/support/gc_extension.h
@@ -2,12 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef WEBKIT_EXTENSIONS_V8_GC_EXTENSION_H_
-#define WEBKIT_EXTENSIONS_V8_GC_EXTENSION_H_
+#ifndef WEBKIT_SUPPORT_GC_EXTENSION_H_
+#define WEBKIT_SUPPORT_GC_EXTENSION_H_
#pragma once
-#include "webkit/extensions/webkit_extensions_export.h"
-
namespace v8 {
class Extension;
}
@@ -18,9 +16,9 @@ namespace extensions_v8 {
// garbage collection. This should only be used for debugging.
class GCExtension {
public:
- WEBKIT_EXTENSIONS_EXPORT static v8::Extension* Get();
+ static v8::Extension* Get();
};
} // namespace extensions_v8
-#endif // WEBKIT_EXTENSIONS_V8_GC_EXTENSION_H_
+#endif // WEBKIT_SUPPORT_GC_EXTENSION_H_
diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc
index 0b11a80..6bcc225 100644
--- a/webkit/support/test_webkit_platform_support.cc
+++ b/webkit/support/test_webkit_platform_support.cc
@@ -35,7 +35,6 @@
#include "v8/include/v8.h"
#include "webkit/appcache/web_application_cache_host_impl.h"
#include "webkit/database/vfs_backend.h"
-#include "webkit/extensions/v8/gc_extension.h"
#include "webkit/glue/simple_webmimeregistry_impl.h"
#include "webkit/glue/webclipboard_impl.h"
#include "webkit/glue/webkit_glue.h"
@@ -44,6 +43,7 @@
#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/support/simple_database_system.h"
+#include "webkit/support/gc_extension.h"
#include "webkit/support/test_webmessageportchannel.h"
#include "webkit/support/webkit_support.h"
#include "webkit/support/weburl_loader_mock_factory.h"
diff --git a/webkit/support/webkit_support.gypi b/webkit/support/webkit_support.gypi
index f42840f..64f3be1 100644
--- a/webkit/support/webkit_support.gypi
+++ b/webkit/support/webkit_support.gypi
@@ -40,6 +40,8 @@
'sources': [
'drt_application_mac.h',
'drt_application_mac.mm',
+ 'gc_extension.cc',
+ 'gc_extension.h',
'platform_support.h',
'platform_support_android.cc',
'platform_support_linux.cc',
diff --git a/webkit/tools/test_shell/node_leak_test.cc b/webkit/tools/test_shell/node_leak_test.cc
index 13ab6b21..5fdf02c 100644
--- a/webkit/tools/test_shell/node_leak_test.cc
+++ b/webkit/tools/test_shell/node_leak_test.cc
@@ -48,11 +48,7 @@ class NodeLeakTest : public TestShellTest {
TestShell::SetFileTestTimeout(timeout_ms);
}
- // Optionally use playback mode (for instance if running automated tests).
- net::HttpCache::Mode mode =
- parsed_command_line.HasSwitch(test_shell::kPlaybackMode) ?
- net::HttpCache::PLAYBACK : net::HttpCache::NORMAL;
- SimpleResourceLoaderBridge::Init(cache_path, mode, false);
+ SimpleResourceLoaderBridge::Init(cache_path, net::HttpCache::NORMAL, false);
TestShellTest::SetUp();
}
diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc
index 8ae0714..9752901 100644
--- a/webkit/tools/test_shell/test_shell_main.cc
+++ b/webkit/tools/test_shell/test_shell_main.cc
@@ -30,10 +30,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h"
#include "ui/gfx/gl/gl_implementation.h"
#include "ui/gfx/gl/gl_switches.h"
-#include "webkit/extensions/v8/gc_extension.h"
-#include "webkit/extensions/v8/heap_profiler_extension.h"
-#include "webkit/extensions/v8/playback_extension.h"
-#include "webkit/extensions/v8/profiler_extension.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webpreferences.h"
#include "webkit/glue/window_open_disposition.h"
@@ -160,21 +156,6 @@ int main(int argc, char* argv[]) {
net::HttpCache::Mode cache_mode = net::HttpCache::NORMAL;
- // This is a special mode where JS helps the browser implement
- // playback/record mode. Generally, in this mode, some functions
- // of client-side randomness are removed. For example, in
- // this mode Math.random() and Date.getTime() may not return
- // values which vary.
- bool playback_mode =
- parsed_command_line.HasSwitch(test_shell::kPlaybackMode);
- bool record_mode =
- parsed_command_line.HasSwitch(test_shell::kRecordMode);
-
- if (playback_mode)
- cache_mode = net::HttpCache::PLAYBACK;
- else if (record_mode)
- cache_mode = net::HttpCache::RECORD;
-
if (parsed_command_line.HasSwitch(test_shell::kEnableFileCookies))
net::CookieMonster::EnableFileScheme();
@@ -277,19 +258,6 @@ int main(int argc, char* argv[]) {
// Test shell always exposes the GC.
webkit_glue::SetJavaScriptFlags("--expose-gc");
- // Expose GCController to JavaScript.
- WebScriptController::registerExtension(extensions_v8::GCExtension::Get());
-
- if (parsed_command_line.HasSwitch(test_shell::kProfiler)) {
- WebScriptController::registerExtension(
- extensions_v8::ProfilerExtension::Get());
- }
-
- if (parsed_command_line.HasSwitch(test_shell::kHeapProfiler)) {
- WebScriptController::registerExtension(
- extensions_v8::HeapProfilerExtension::Get());
- }
-
// Load and initialize the stats table. Attempt to construct a somewhat
// unique name to isolate separate instances from each other.
@@ -305,36 +273,13 @@ int main(int argc, char* argv[]) {
TestShell* shell;
if (TestShell::CreateNewWindow(starting_url, &shell)) {
- if (record_mode || playback_mode) {
- platform.SetWindowPositionForRecording(shell);
- WebScriptController::registerExtension(
- extensions_v8::PlaybackExtension::Get());
- }
-
shell->Show(WebKit::WebNavigationPolicyNewWindow);
if (parsed_command_line.HasSwitch(test_shell::kDumpStatsTable))
shell->DumpStatsTableOnExit();
- bool no_events = parsed_command_line.HasSwitch(test_shell::kNoEvents);
- if ((record_mode || playback_mode) && !no_events) {
- FilePath script_path = cache_path;
- // Create the cache directory in case it doesn't exist.
- file_util::CreateDirectory(cache_path);
- script_path = script_path.AppendASCII("script.log");
- if (record_mode)
- base::EventRecorder::current()->StartRecording(script_path);
- if (playback_mode)
- base::EventRecorder::current()->StartPlayback(script_path);
- }
-
webkit_glue::SetJavaScriptFlags(TestShell::GetJSFlagsForLoad(0));
MessageLoop::current()->Run();
-
- if (record_mode)
- base::EventRecorder::current()->StopRecording();
- if (playback_mode)
- base::EventRecorder::current()->StopPlayback();
}
TestShell::ShutdownTestShell();
diff --git a/webkit/tools/test_shell/test_shell_switches.cc b/webkit/tools/test_shell/test_shell_switches.cc
index ab5941f..eafdfa4 100644
--- a/webkit/tools/test_shell/test_shell_switches.cc
+++ b/webkit/tools/test_shell/test_shell_switches.cc
@@ -43,15 +43,6 @@ const char kMultipleLoads[] = "multiple-loads";
// in the corresponding load.
const char kJavaScriptFlags[] = "js-flags";
-// Run the http cache in record mode.
-const char kRecordMode[] = "record-mode";
-
-// Run the http cache in playback mode.
-const char kPlaybackMode[] = "playback-mode";
-
-// Don't record/playback events when using record & playback.
-const char kNoEvents[] = "no-events";
-
// Dump stats table on exit.
const char kDumpStatsTable[] = "stats";
@@ -73,12 +64,6 @@ const char kCheckLayoutTestSystemDeps[] = "check-layout-test-sys-deps";
// to happen even if in layout test mode.
const char kGDB[] = "gdb";
-// Make functions of the Profiler class available in javascript
-const char kProfiler[] = "profiler";
-
-// Make functions of the HeapProfiler class available in javascript
-const char kHeapProfiler[] = "heap-profiler";
-
const char kAllowExternalPages[] = "allow-external-pages";
const char kEnableAccel2DCanvas[] = "enable-accelerated-2d-canvas";
diff --git a/webkit/tools/test_shell/test_shell_switches.h b/webkit/tools/test_shell/test_shell_switches.h
index a7255f1..f45296a 100644
--- a/webkit/tools/test_shell/test_shell_switches.h
+++ b/webkit/tools/test_shell/test_shell_switches.h
@@ -20,17 +20,12 @@ extern const char kStartupDialog[];
extern const char kGPFaultErrorBox[];
extern const char kJavaScriptFlags[];
extern const char kMultipleLoads[];
-extern const char kRecordMode[];
-extern const char kPlaybackMode[];
-extern const char kNoEvents[];
extern const char kDumpStatsTable[];
extern const char kCacheDir[];
extern const char kEnableFileCookies[];
extern const char kAllowScriptsToCloseWindows[];
extern const char kCheckLayoutTestSystemDeps[];
extern const char kGDB[];
-extern const char kProfiler[];
-extern const char kHeapProfiler[];
extern const char kAllowExternalPages[];
extern const char kEnableAccel2DCanvas[];
extern const char kEnableAccelCompositing[];