Skip to content
Snippets Groups Projects
Commit 46210f04 authored by mlloyd@chromium.org's avatar mlloyd@chromium.org
Browse files

Show a warning message if the cache might not be cleared between runs.

BUG=None.
TEST=Unit tests pass.

Review URL: http://codereview.chromium.org/2819037

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51541 0039d316-1c4b-4281-b951-d872f2087c98
parent 0b004da8
No related branches found
No related tags found
No related merge requests found
......@@ -322,6 +322,20 @@ chrome.extension.onConnect.addListener(function(port) {
});
function run() {
if (window.clearCache) {
// Show a warning if we will try to clear the cache between runs
// but will also be reusing the same WebKit instance (i.e. Chrome
// is in single-process mode, or 'Use New Tabs' is turned off)
// because the WebKit cache might not get completely cleared between runs.
if (chrome.benchmarking.isSingleProcess()) {
alert("Warning: the WebKit cache may not be cleared correctly " +
"between runs because Chrome is running in single-process mode.");
} else if (!window.useNewTabs) {
alert("Warning: the WebKit cache may not be cleared correctly " +
"between runs because 'Use New Tabs Per Page' is turned off.");
}
}
var urls = testUrl.split(",");
for (var i = 0; i < urls.length; i++) {
var benchmark = new Benchmark();
......
......@@ -15,6 +15,7 @@
#include "app/clipboard/clipboard.h"
#include "app/clipboard/scoped_clipboard_writer.h"
#include "app/resource_bundle.h"
#include "base/command_line.h"
#include "base/file_version_info.h"
#include "base/ref_counted.h"
#include "base/string_util.h"
......@@ -281,4 +282,8 @@ std::string GetProductVersion() {
return product;
}
bool IsSingleProcess() {
return CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess);
}
} // namespace webkit_glue
......@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "base/stats_table.h"
#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
#include "webkit/extensions/v8/benchmarking_extension.h"
......@@ -35,6 +36,10 @@ class BenchmarkingWrapper : public v8::Extension {
" native function GetCounter();"
" return GetCounter(name);"
"};"
"chrome.benchmarking.isSingleProcess = function() {"
" native function IsSingleProcess();"
" return IsSingleProcess();"
"};"
) {}
virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
......@@ -45,6 +50,8 @@ class BenchmarkingWrapper : public v8::Extension {
return v8::FunctionTemplate::New(ClearCache);
} 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);
}
return v8::Handle<v8::FunctionTemplate>();
}
......@@ -73,6 +80,10 @@ class BenchmarkingWrapper : public v8::Extension {
int counter = 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());
}
};
v8::Extension* BenchmarkingExtension::Get() {
......
......@@ -248,6 +248,9 @@ void ClearCache();
// Returns the product version. E.g., Chrome/4.1.333.0
std::string GetProductVersion();
// Returns true if the embedder is running in single process mode.
bool IsSingleProcess();
// ---- END FUNCTIONS IMPLEMENTED BY EMBEDDER ---------------------------------
......
......@@ -68,4 +68,8 @@ bool DownloadUrl(const std::string& url, HWND caller_window) {
}
#endif
bool IsSingleProcess() {
return true;
}
} // namespace webkit_glue
......@@ -809,4 +809,8 @@ std::string GetProductVersion() {
return std::string("Chrome/0.0.0.0");
}
bool IsSingleProcess() {
return true;
}
} // namespace webkit_glue
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment