diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-15 01:19:03 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-15 01:19:03 +0000 |
commit | 6f08af88709675d9c1b63f9b7c7383844d36386f (patch) | |
tree | dfef137d617ecb26ff156aee7d800067e161d613 /webkit | |
parent | 2c7e28115d1334537dbf984ad6bf2bebf46c8739 (diff) | |
download | chromium_src-6f08af88709675d9c1b63f9b7c7383844d36386f.zip chromium_src-6f08af88709675d9c1b63f9b7c7383844d36386f.tar.gz chromium_src-6f08af88709675d9c1b63f9b7c7383844d36386f.tar.bz2 |
Move the V8 benchmarking_extension.cc/.h files out of webkit/extensions into chrome as the functionality
exposed by this extension is chrome specific. The IPCs used by this extension have all been moved to chrome
to a new header file benchmarking_messages.h in chrome\common.
Added a new message filter object in chrome\browser which filters the benchmarking IPCs.
Most of the changes in this CL are centered around ensuring that the benchmarking stuff gets initialized
in the same order as before.
Continuing changes to get rid of the pattern of IPC messags spanning across content and chrome.
BUG=87335
Review URL: http://codereview.chromium.org/7885013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101214 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/extensions/v8/benchmarking_extension.cc | 164 | ||||
-rw-r--r-- | webkit/extensions/v8/benchmarking_extension.h | 25 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.gypi | 2 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.h | 21 | ||||
-rw-r--r-- | webkit/support/webkit_support_glue.cc | 15 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 24 |
6 files changed, 0 insertions, 251 deletions
diff --git a/webkit/extensions/v8/benchmarking_extension.cc b/webkit/extensions/v8/benchmarking_extension.cc deleted file mode 100644 index f3f4c72..0000000 --- a/webkit/extensions/v8/benchmarking_extension.cc +++ /dev/null @@ -1,164 +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/benchmarking_extension.h" - -#include "base/metrics/stats_table.h" -#include "base/time.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" -#include "v8/include/v8.h" -#include "webkit/glue/webkit_glue.h" - -using WebKit::WebCache; - -const char kBenchmarkingExtensionName[] = "v8/Benchmarking"; - -namespace extensions_v8 { - -class BenchmarkingWrapper : public v8::Extension { - public: - BenchmarkingWrapper() : - v8::Extension(kBenchmarkingExtensionName, - "if (typeof(chrome) == 'undefined') {" - " chrome = {};" - "};" - "if (typeof(chrome.benchmarking) == 'undefined') {" - " chrome.benchmarking = {};" - "};" - "chrome.benchmarking.clearCache = function(preserve_ssl_entries) {" - " native function ClearCache();" - " ClearCache(preserve_ssl_entries);" - "};" - "chrome.benchmarking.clearHostResolverCache = function() {" - " native function ClearHostResolverCache();" - " ClearHostResolverCache();" - "};" - "chrome.benchmarking.clearPredictorCache = function() {" - " native function ClearPredictorCache();" - " ClearPredictorCache();" - "};" - "chrome.benchmarking.closeConnections = function() {" - " native function CloseConnections();" - " CloseConnections();" - "};" - "chrome.benchmarking.counter = function(name) {" - " native function GetCounter();" - " return GetCounter(name);" - "};" - "chrome.benchmarking.enableSpdy = function(name) {" - " native function EnableSpdy();" - " EnableSpdy(name);" - "};" - "chrome.benchmarking.isSingleProcess = function() {" - " native function IsSingleProcess();" - " return IsSingleProcess();" - "};" - "chrome.Interval = function() {" - " var start_ = 0;" - " var stop_ = 0;" - " native function HiResTime();" - " this.start = function() {" - " stop_ = 0;" - " start_ = HiResTime();" - " };" - " this.stop = function() {" - " stop_ = HiResTime();" - " if (start_ == 0)" - " stop_ = 0;" - " };" - " this.microseconds = function() {" - " var stop = stop_;" - " if (stop == 0 && start_ != 0)" - " stop = HiResTime();" - " return Math.ceil(stop - start_);" - " };" - "}" - ) {} - - virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( - v8::Handle<v8::String> name) { - if (name->Equals(v8::String::New("CloseConnections"))) { - return v8::FunctionTemplate::New(CloseConnections); - } else if (name->Equals(v8::String::New("ClearCache"))) { - return v8::FunctionTemplate::New(ClearCache); - } else if (name->Equals(v8::String::New("ClearHostResolverCache"))) { - return v8::FunctionTemplate::New(ClearHostResolverCache); - } else if (name->Equals(v8::String::New("ClearPredictorCache"))) { - return v8::FunctionTemplate::New(ClearPredictorCache); - } else if (name->Equals(v8::String::New("EnableSpdy"))) { - return v8::FunctionTemplate::New(EnableSpdy); - } else if (name->Equals(v8::String::New("GetCounter"))) { - return v8::FunctionTemplate::New(GetCounter); - } else if (name->Equals(v8::String::New("IsSingleProcess"))) { - return v8::FunctionTemplate::New(IsSingleProcess); - } else if (name->Equals(v8::String::New("HiResTime"))) { - return v8::FunctionTemplate::New(HiResTime); - } - - return v8::Handle<v8::FunctionTemplate>(); - } - - static v8::Handle<v8::Value> CloseConnections(const v8::Arguments& args) { - webkit_glue::CloseCurrentConnections(); - return v8::Undefined(); - } - - static v8::Handle<v8::Value> ClearCache(const v8::Arguments& args) { - bool preserve_ssl_host_entries = false; - if (args.Length() && args[0]->IsBoolean()) - preserve_ssl_host_entries = args[0]->BooleanValue(); - webkit_glue::ClearCache(preserve_ssl_host_entries); - WebCache::clear(); - return v8::Undefined(); - } - - static v8::Handle<v8::Value> ClearHostResolverCache( - const v8::Arguments& args) { - webkit_glue::ClearHostResolverCache(); - return v8::Undefined(); - } - - static v8::Handle<v8::Value> ClearPredictorCache( - const v8::Arguments& args) { - webkit_glue::ClearPredictorCache(); - return v8::Undefined(); - } - - static v8::Handle<v8::Value> EnableSpdy(const v8::Arguments& args) { - if (!args.Length() || !args[0]->IsBoolean()) - return v8::Undefined(); - - webkit_glue::EnableSpdy(args[0]->BooleanValue()); - return v8::Undefined(); - } - - static v8::Handle<v8::Value> GetCounter(const v8::Arguments& args) { - if (!args.Length() || !args[0]->IsString() || !base::StatsTable::current()) - return v8::Undefined(); - - // Extract the name argument - char name[256]; - name[0] = 'c'; - name[1] = ':'; - args[0]->ToString()->WriteAscii(&name[2], 0, sizeof(name) - 3); - - int counter = base::StatsTable::current()->GetCounterValue(name); - return v8::Integer::New(counter); - } - - static v8::Handle<v8::Value> IsSingleProcess(const v8::Arguments& args) { - return v8::Boolean::New(webkit_glue::IsSingleProcess()); - } - - static v8::Handle<v8::Value> HiResTime(const v8::Arguments& args) { - return v8::Number::New( - static_cast<double>(base::TimeTicks::HighResNow().ToInternalValue())); - } -}; - -v8::Extension* BenchmarkingExtension::Get() { - return new BenchmarkingWrapper(); -} - -} // namespace extensions_v8 diff --git a/webkit/extensions/v8/benchmarking_extension.h b/webkit/extensions/v8/benchmarking_extension.h deleted file mode 100644 index 3aa5cee..0000000 --- a/webkit/extensions/v8/benchmarking_extension.h +++ /dev/null @@ -1,25 +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_BENCHMARKING_EXTENSION_H_ -#define WEBKIT_EXTENSIONS_V8_BENCHMARKING_EXTENSION_H_ -#pragma once - -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 BenchmarkingExtension { - public: - static v8::Extension* Get(); -}; - -} // namespace extensions_v8 - -#endif // WEBKIT_EXTENSIONS_V8_BENCHMARKING_EXTENSION_H_ diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 025c3f6..0938301 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -430,8 +430,6 @@ # These files used to be built in the webcore target, but moved here # since part of glue. - '../extensions/v8/benchmarking_extension.cc', - '../extensions/v8/benchmarking_extension.h', '../extensions/v8/gc_extension.cc', '../extensions/v8/gc_extension.h', '../extensions/v8/heap_profiler_extension.cc', diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index 8e5ea40..54cfdc1 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -215,30 +215,9 @@ bool IsProtocolSupportedForMedia(const GURL& url); // the form language-country (e.g., en-US or pt-BR). std::string GetWebKitLocale(); -// Close current connections. Used for debugging. -void CloseCurrentConnections(); - -// Enable or disable the disk cache. Used for debugging. -void SetCacheMode(bool enabled); - -// Clear the disk cache. Used for debugging. -// |preserve_ssl_host_info| indicates whether disk cache entries related to -// SSL information should be purged. -void ClearCache(bool preserve_ssl_host_info); - -// Clear the host resolver cache. Used for debugging. -void ClearHostResolverCache(); - -// Clear the predictor cache (for DNS prefetch and preconnect). Used for -// debugging. -void ClearPredictorCache(); - // Returns true if the embedder is running in single process mode. bool IsSingleProcess(); -// Enables/Disables Spdy for requests afterwards. Used for benchmarking. -void EnableSpdy(bool enable); - #if defined(OS_LINUX) // Return a read-only file descriptor to the font which best matches the given // properties or -1 on failure. diff --git a/webkit/support/webkit_support_glue.cc b/webkit/support/webkit_support_glue.cc index 968b649..501356e 100644 --- a/webkit/support/webkit_support_glue.cc +++ b/webkit/support/webkit_support_glue.cc @@ -53,21 +53,6 @@ std::string GetWebKitLocale() { return "en-US"; } -void CloseCurrentConnections() { -} - -void SetCacheMode(bool enabled) { -} - -void ClearCache(bool preserve_ssl_info) { -} - -void ClearHostResolverCache() { -} - -void ClearPredictorCache() { -} - std::string BuildUserAgent(bool mimic_windows) { return webkit_glue::BuildUserAgentHelper(mimic_windows, "DumpRenderTree/0.0.0.0"); diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index d4315a7..7c78dbc 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -639,30 +639,6 @@ std::string GetWebKitLocale() { return "en-US"; } -void CloseCurrentConnections() { - // Used in benchmarking, Ignored for test_shell. -} - -void SetCacheMode(bool enabled) { - // Used in benchmarking, Ignored for test_shell. -} - -void ClearCache(bool preserve_ssl_entries) { - // Used in benchmarking, Ignored for test_shell. -} - -void ClearHostResolverCache() { - // Used in benchmarking, Ignored for test_shell. -} - -void ClearPredictorCache() { - // Used in benchmarking, Ignored for test_shell. -} - -void EnableSpdy(bool enable) { - // Used in benchmarking, Ignored for test_shell. -} - std::string BuildUserAgent(bool mimic_windows) { return webkit_glue::BuildUserAgentHelper(mimic_windows, "Chrome/0.0.0.0"); } |