Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(798)

Side by Side Diff: content/browser/indexed_db/indexed_db_callbacks.cc

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/indexed_db/indexed_db_callbacks.h" 5 #include "content/browser/indexed_db/indexed_db_callbacks.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "content/browser/child_process_security_policy_impl.h" 13 #include "content/browser/child_process_security_policy_impl.h"
14 #include "content/browser/fileapi/fileapi_message_filter.h" 14 #include "content/browser/fileapi/fileapi_message_filter.h"
15 #include "content/browser/indexed_db/indexed_db_blob_info.h" 15 #include "content/browser/indexed_db/indexed_db_blob_info.h"
16 #include "content/browser/indexed_db/indexed_db_connection.h" 16 #include "content/browser/indexed_db/indexed_db_connection.h"
17 #include "content/browser/indexed_db/indexed_db_context_impl.h" 17 #include "content/browser/indexed_db/indexed_db_context_impl.h"
18 #include "content/browser/indexed_db/indexed_db_cursor.h" 18 #include "content/browser/indexed_db/indexed_db_cursor.h"
19 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" 19 #include "content/browser/indexed_db/indexed_db_database_callbacks.h"
20 #include "content/browser/indexed_db/indexed_db_database_error.h" 20 #include "content/browser/indexed_db/indexed_db_database_error.h"
21 #include "content/browser/indexed_db/indexed_db_metadata.h" 21 #include "content/browser/indexed_db/indexed_db_metadata.h"
22 #include "content/browser/indexed_db/indexed_db_value.h" 22 #include "content/browser/indexed_db/indexed_db_value.h"
23 #include "content/common/indexed_db/indexed_db_constants.h" 23 #include "content/common/indexed_db/indexed_db_constants.h"
24 #include "content/common/indexed_db/indexed_db_messages.h" 24 #include "content/common/indexed_db/indexed_db_messages.h"
25 #include "webkit/browser/blob/blob_storage_context.h" 25 #include "webkit/browser/blob/blob_storage_context.h"
26 #include "webkit/browser/quota/quota_manager.h" 26 #include "webkit/browser/quota/quota_manager.h"
27 #include "webkit/common/blob/blob_data.h" 27 #include "webkit/common/blob/blob_data.h"
28 #include "webkit/common/blob/shareable_file_reference.h" 28 #include "webkit/common/blob/shareable_file_reference.h"
29 29
30 using webkit_blob::ShareableFileReference; 30 using storage::ShareableFileReference;
31 31
32 namespace content { 32 namespace content {
33 33
34 namespace { 34 namespace {
35 const int32 kNoCursor = -1; 35 const int32 kNoCursor = -1;
36 const int32 kNoDatabaseCallbacks = -1; 36 const int32 kNoDatabaseCallbacks = -1;
37 const int64 kNoTransaction = -1; 37 const int64 kNoTransaction = -1;
38 } 38 }
39 39
40 IndexedDBCallbacks::IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, 40 IndexedDBCallbacks::IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host,
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 UMA_HISTOGRAM_MEDIUM_TIMES( 216 UMA_HISTOGRAM_MEDIUM_TIMES(
217 "WebCore.IndexedDB.OpenTime.Success", 217 "WebCore.IndexedDB.OpenTime.Success",
218 base::TimeTicks::Now() - connection_open_start_time_); 218 base::TimeTicks::Now() - connection_open_start_time_);
219 connection_open_start_time_ = base::TimeTicks(); 219 connection_open_start_time_ = base::TimeTicks();
220 } 220 }
221 } 221 }
222 222
223 static std::string CreateBlobData( 223 static std::string CreateBlobData(
224 const IndexedDBBlobInfo& blob_info, 224 const IndexedDBBlobInfo& blob_info,
225 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host, 225 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host,
226 webkit_blob::BlobStorageContext* blob_storage_context, 226 storage::BlobStorageContext* blob_storage_context,
227 base::TaskRunner* task_runner) { 227 base::TaskRunner* task_runner) {
228 std::string uuid = blob_info.uuid(); 228 std::string uuid = blob_info.uuid();
229 if (!uuid.empty()) { 229 if (!uuid.empty()) {
230 // We're sending back a live blob, not a reference into our backing store. 230 // We're sending back a live blob, not a reference into our backing store.
231 scoped_ptr<webkit_blob::BlobDataHandle> blob_data_handle( 231 scoped_ptr<storage::BlobDataHandle> blob_data_handle(
232 blob_storage_context->GetBlobDataFromUUID(uuid)); 232 blob_storage_context->GetBlobDataFromUUID(uuid));
233 dispatcher_host->HoldBlobDataHandle(uuid, blob_data_handle.Pass()); 233 dispatcher_host->HoldBlobDataHandle(uuid, blob_data_handle.Pass());
234 return uuid; 234 return uuid;
235 } 235 }
236 scoped_refptr<ShareableFileReference> shareable_file = 236 scoped_refptr<ShareableFileReference> shareable_file =
237 ShareableFileReference::Get(blob_info.file_path()); 237 ShareableFileReference::Get(blob_info.file_path());
238 if (!shareable_file.get()) { 238 if (!shareable_file.get()) {
239 shareable_file = ShareableFileReference::GetOrCreate( 239 shareable_file = ShareableFileReference::GetOrCreate(
240 blob_info.file_path(), 240 blob_info.file_path(),
241 ShareableFileReference::DONT_DELETE_ON_FINAL_RELEASE, 241 ShareableFileReference::DONT_DELETE_ON_FINAL_RELEASE,
242 task_runner); 242 task_runner);
243 if (!blob_info.release_callback().is_null()) 243 if (!blob_info.release_callback().is_null())
244 shareable_file->AddFinalReleaseCallback(blob_info.release_callback()); 244 shareable_file->AddFinalReleaseCallback(blob_info.release_callback());
245 } 245 }
246 246
247 uuid = base::GenerateGUID(); 247 uuid = base::GenerateGUID();
248 scoped_refptr<webkit_blob::BlobData> blob_data = 248 scoped_refptr<storage::BlobData> blob_data = new storage::BlobData(uuid);
249 new webkit_blob::BlobData(uuid);
250 blob_data->AppendFile( 249 blob_data->AppendFile(
251 blob_info.file_path(), 0, blob_info.size(), blob_info.last_modified()); 250 blob_info.file_path(), 0, blob_info.size(), blob_info.last_modified());
252 scoped_ptr<webkit_blob::BlobDataHandle> blob_data_handle( 251 scoped_ptr<storage::BlobDataHandle> blob_data_handle(
253 blob_storage_context->AddFinishedBlob(blob_data.get())); 252 blob_storage_context->AddFinishedBlob(blob_data.get()));
254 dispatcher_host->HoldBlobDataHandle(uuid, blob_data_handle.Pass()); 253 dispatcher_host->HoldBlobDataHandle(uuid, blob_data_handle.Pass());
255 254
256 return uuid; 255 return uuid;
257 } 256 }
258 257
259 static bool CreateAllBlobs( 258 static bool CreateAllBlobs(
260 const std::vector<IndexedDBBlobInfo>& blob_info, 259 const std::vector<IndexedDBBlobInfo>& blob_info,
261 std::vector<IndexedDBMsg_BlobOrFileInfo>* blob_or_file_info, 260 std::vector<IndexedDBMsg_BlobOrFileInfo>* blob_or_file_info,
262 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host) { 261 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host) {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 ipc_thread_id_, ipc_callbacks_id_)); 606 ipc_thread_id_, ipc_callbacks_id_));
608 dispatcher_host_ = NULL; 607 dispatcher_host_ = NULL;
609 } 608 }
610 609
611 void IndexedDBCallbacks::SetConnectionOpenStartTime( 610 void IndexedDBCallbacks::SetConnectionOpenStartTime(
612 const base::TimeTicks& start_time) { 611 const base::TimeTicks& start_time) {
613 connection_open_start_time_ = start_time; 612 connection_open_start_time_ = start_time;
614 } 613 }
615 614
616 } // namespace content 615 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_browsertest.cc ('k') | content/browser/indexed_db/indexed_db_context_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698