From 8990e4716c6bf3f19625d24be013502fc6e24873 Mon Sep 17 00:00:00 2001 From: "tonyg@chromium.org" Date: Mon, 28 Mar 2011 20:50:55 +0000 Subject: Add chrome.benchmark routines to clear the host and predictor caches. This will be used in web-page-replay to enable TCP preconnect and DNS prefetch. BUG=None TEST=unit_tests passes Review URL: http://codereview.chromium.org/6660008 Patch from Ziga Mahkovec . git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79610 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/extensions/v8/benchmarking_extension.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'webkit/extensions') diff --git a/webkit/extensions/v8/benchmarking_extension.cc b/webkit/extensions/v8/benchmarking_extension.cc index 600eafa..e622ba7 100644 --- a/webkit/extensions/v8/benchmarking_extension.cc +++ b/webkit/extensions/v8/benchmarking_extension.cc @@ -31,6 +31,14 @@ class BenchmarkingWrapper : public v8::Extension { " 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();" @@ -75,6 +83,10 @@ class BenchmarkingWrapper : public v8::Extension { 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"))) { @@ -102,6 +114,18 @@ class BenchmarkingWrapper : public v8::Extension { return v8::Undefined(); } + static v8::Handle ClearHostResolverCache( + const v8::Arguments& args) { + webkit_glue::ClearHostResolverCache(); + return v8::Undefined(); + } + + static v8::Handle ClearPredictorCache( + const v8::Arguments& args) { + webkit_glue::ClearPredictorCache(); + return v8::Undefined(); + } + static v8::Handle EnableSpdy(const v8::Arguments& args) { if (!args.Length() || !args[0]->IsBoolean()) return v8::Undefined(); -- cgit v1.1