summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorhans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 13:44:31 +0000
committerhans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 13:44:31 +0000
commitdbbad7cc03be4a7181ad53991fcb9b38ae719077 (patch)
tree00e66ef801ba31f8198cc2b068539ff3c6050587 /chrome
parent1b8f3b24517911f4430259ec820ecfd5b1976e19 (diff)
downloadchromium_src-dbbad7cc03be4a7181ad53991fcb9b38ae719077.zip
chromium_src-dbbad7cc03be4a7181ad53991fcb9b38ae719077.tar.gz
chromium_src-dbbad7cc03be4a7181ad53991fcb9b38ae719077.tar.bz2
IndexedDB: Keep the utility process open.
Lazily create the process when it is first needed, and keep it running. This significantly speeds up data insertion when there is a key path. BUG=60138 TEST= Review URL: http://codereview.chromium.org/4678002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65942 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/in_process_webkit/browser_webkitclient_impl.cc21
-rw-r--r--chrome/browser/in_process_webkit/browser_webkitclient_impl.h6
-rw-r--r--chrome/browser/in_process_webkit/indexed_db_key_utility_client.cc6
3 files changed, 22 insertions, 11 deletions
diff --git a/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc b/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc
index 365c91c..df541e8 100644
--- a/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc
+++ b/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc
@@ -20,6 +20,9 @@ BrowserWebKitClientImpl::BrowserWebKitClientImpl() {
file_utilities_.set_sandbox_enabled(false);
}
+BrowserWebKitClientImpl::~BrowserWebKitClientImpl() {
+}
+
WebKit::WebClipboard* BrowserWebKitClientImpl::clipboard() {
NOTREACHED();
return NULL;
@@ -144,15 +147,19 @@ int BrowserWebKitClientImpl::databaseDeleteFile(
return file_util::Delete(path, false) ? 0 : 1;
}
+void BrowserWebKitClientImpl::idbShutdown() {
+ if (indexed_db_key_utility_client_.get())
+ indexed_db_key_utility_client_->EndUtilityProcess();
+}
+
void BrowserWebKitClientImpl::createIDBKeysFromSerializedValuesAndKeyPath(
const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values,
const WebKit::WebString& keyPath,
WebKit::WebVector<WebKit::WebIDBKey>& keys) {
- // TODO(bulach): we need to figure out a way to keep the utility process
- // running for longer, and shut it down when no longer used.
- scoped_refptr<IndexedDBKeyUtilityClient> indexed_db_key_utility_client(
- new IndexedDBKeyUtilityClient());
- indexed_db_key_utility_client->StartUtilityProcess();
+ if (!indexed_db_key_utility_client_.get()) {
+ indexed_db_key_utility_client_ = new IndexedDBKeyUtilityClient();
+ indexed_db_key_utility_client_->StartUtilityProcess();
+ }
std::vector<SerializedScriptValue> std_values;
size_t size = values.size();
@@ -161,10 +168,8 @@ void BrowserWebKitClientImpl::createIDBKeysFromSerializedValuesAndKeyPath(
std_values.push_back(SerializedScriptValue(values[i]));
std::vector<IndexedDBKey> std_keys;
- indexed_db_key_utility_client->CreateIDBKeysFromSerializedValuesAndKeyPath(
+ indexed_db_key_utility_client_->CreateIDBKeysFromSerializedValuesAndKeyPath(
std_values, keyPath, &std_keys);
- indexed_db_key_utility_client->EndUtilityProcess();
-
keys = std_keys;
}
diff --git a/chrome/browser/in_process_webkit/browser_webkitclient_impl.h b/chrome/browser/in_process_webkit/browser_webkitclient_impl.h
index dd291c8..bc0dd5d 100644
--- a/chrome/browser/in_process_webkit/browser_webkitclient_impl.h
+++ b/chrome/browser/in_process_webkit/browser_webkitclient_impl.h
@@ -6,12 +6,16 @@
#define CHROME_BROWSER_IN_PROCESS_WEBKIT_BROWSER_WEBKITCLIENT_IMPL_H_
#pragma once
+#include "base/ref_counted.h"
#include "webkit/glue/webfileutilities_impl.h"
#include "webkit/glue/webkitclient_impl.h"
+class IndexedDBKeyUtilityClient;
+
class BrowserWebKitClientImpl : public webkit_glue::WebKitClientImpl {
public:
BrowserWebKitClientImpl();
+ virtual ~BrowserWebKitClientImpl();
// WebKitClient methods:
virtual WebKit::WebClipboard* clipboard();
@@ -45,6 +49,7 @@ class BrowserWebKitClientImpl : public webkit_glue::WebKitClientImpl {
virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository();
virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name,
bool sync_dir);
+ virtual void idbShutdown();
virtual void createIDBKeysFromSerializedValuesAndKeyPath(
const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values,
const WebKit::WebString& keyPath,
@@ -52,6 +57,7 @@ class BrowserWebKitClientImpl : public webkit_glue::WebKitClientImpl {
private:
webkit_glue::WebFileUtilitiesImpl file_utilities_;
+ scoped_refptr<IndexedDBKeyUtilityClient> indexed_db_key_utility_client_;
};
#endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_BROWSER_WEBKITCLIENT_IMPL_H_
diff --git a/chrome/browser/in_process_webkit/indexed_db_key_utility_client.cc b/chrome/browser/in_process_webkit/indexed_db_key_utility_client.cc
index 6667d50..920da34 100644
--- a/chrome/browser/in_process_webkit/indexed_db_key_utility_client.cc
+++ b/chrome/browser/in_process_webkit/indexed_db_key_utility_client.cc
@@ -1,6 +1,6 @@
-// Copyright (c) 2009 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.
+// Copyright (c) 2009 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/browser/in_process_webkit/indexed_db_key_utility_client.h"