| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/in_process_webkit/browser_webkitclient_impl.h" | 5 #include "chrome/browser/in_process_webkit/browser_webkitclient_impl.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/in_process_webkit/dom_storage_message_filter.h" | 9 #include "chrome/browser/in_process_webkit/dom_storage_message_filter.h" |
| 10 #include "chrome/browser/in_process_webkit/indexed_db_key_utility_client.h" | 10 #include "chrome/browser/in_process_webkit/indexed_db_key_utility_client.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 return NULL; | 141 return NULL; |
| 142 } | 142 } |
| 143 | 143 |
| 144 int BrowserWebKitClientImpl::databaseDeleteFile( | 144 int BrowserWebKitClientImpl::databaseDeleteFile( |
| 145 const WebKit::WebString& vfs_file_name, bool sync_dir) { | 145 const WebKit::WebString& vfs_file_name, bool sync_dir) { |
| 146 const FilePath path = webkit_glue::WebStringToFilePath(vfs_file_name); | 146 const FilePath path = webkit_glue::WebStringToFilePath(vfs_file_name); |
| 147 return file_util::Delete(path, false) ? 0 : 1; | 147 return file_util::Delete(path, false) ? 0 : 1; |
| 148 } | 148 } |
| 149 | 149 |
| 150 void BrowserWebKitClientImpl::idbShutdown() { | 150 void BrowserWebKitClientImpl::idbShutdown() { |
| 151 if (indexed_db_key_utility_client_.get()) | 151 if (indexed_db_key_utility_client_.get()) { |
| 152 indexed_db_key_utility_client_->EndUtilityProcess(); | 152 indexed_db_key_utility_client_->EndUtilityProcess(); |
| 153 indexed_db_key_utility_client_ = NULL; |
| 154 } |
| 153 } | 155 } |
| 154 | 156 |
| 155 void BrowserWebKitClientImpl::createIDBKeysFromSerializedValuesAndKeyPath( | 157 void BrowserWebKitClientImpl::createIDBKeysFromSerializedValuesAndKeyPath( |
| 156 const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, | 158 const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values, |
| 157 const WebKit::WebString& keyPath, | 159 const WebKit::WebString& keyPath, |
| 158 WebKit::WebVector<WebKit::WebIDBKey>& keys) { | 160 WebKit::WebVector<WebKit::WebIDBKey>& keys) { |
| 159 if (!indexed_db_key_utility_client_.get()) { | 161 if (!indexed_db_key_utility_client_.get()) { |
| 160 indexed_db_key_utility_client_ = new IndexedDBKeyUtilityClient(); | 162 indexed_db_key_utility_client_ = new IndexedDBKeyUtilityClient(); |
| 161 indexed_db_key_utility_client_->StartUtilityProcess(); | 163 indexed_db_key_utility_client_->StartUtilityProcess(); |
| 162 } | 164 } |
| 163 | 165 |
| 164 std::vector<SerializedScriptValue> std_values; | 166 std::vector<SerializedScriptValue> std_values; |
| 165 size_t size = values.size(); | 167 size_t size = values.size(); |
| 166 std_values.reserve(size); | 168 std_values.reserve(size); |
| 167 for (size_t i = 0; i < size; ++i) | 169 for (size_t i = 0; i < size; ++i) |
| 168 std_values.push_back(SerializedScriptValue(values[i])); | 170 std_values.push_back(SerializedScriptValue(values[i])); |
| 169 | 171 |
| 170 std::vector<IndexedDBKey> std_keys; | 172 std::vector<IndexedDBKey> std_keys; |
| 171 indexed_db_key_utility_client_->CreateIDBKeysFromSerializedValuesAndKeyPath( | 173 indexed_db_key_utility_client_->CreateIDBKeysFromSerializedValuesAndKeyPath( |
| 172 std_values, keyPath, &std_keys); | 174 std_values, keyPath, &std_keys); |
| 173 | 175 |
| 174 keys = std_keys; | 176 keys = std_keys; |
| 175 } | 177 } |
| OLD | NEW |