| OLD | NEW |
| 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/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 const std::vector<IndexedDBBlobInfo>& blob_info, | 242 const std::vector<IndexedDBBlobInfo>& blob_info, |
| 243 std::vector<IndexedDBMsg_BlobOrFileInfo>* blob_or_file_info) { | 243 std::vector<IndexedDBMsg_BlobOrFileInfo>* blob_or_file_info) { |
| 244 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 244 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 245 if (CreateAllBlobs(blob_info, blob_or_file_info, dispatcher_host)) | 245 if (CreateAllBlobs(blob_info, blob_or_file_info, dispatcher_host)) |
| 246 dispatcher_host->Send(new MsgType(*params)); | 246 dispatcher_host->Send(new MsgType(*params)); |
| 247 } | 247 } |
| 248 | 248 |
| 249 static void BlobLookupForCursorPrefetch( | 249 static void BlobLookupForCursorPrefetch( |
| 250 IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params* params, | 250 IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params* params, |
| 251 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host, | 251 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host, |
| 252 const std::vector<IndexedDBValue>& values, | 252 const std::vector<IndexedDBValue>& values) { |
| 253 std::vector<std::vector<IndexedDBMsg_BlobOrFileInfo> >* | |
| 254 blob_or_file_infos) { | |
| 255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 253 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 256 DCHECK_EQ(values.size(), blob_or_file_infos->size()); | 254 DCHECK_EQ(values.size(), params->blob_or_file_infos.size()); |
| 257 | 255 |
| 258 std::vector<IndexedDBValue>::const_iterator value_iter; | 256 std::vector<IndexedDBValue>::const_iterator value_iter; |
| 259 std::vector<std::vector<IndexedDBMsg_BlobOrFileInfo> >::iterator blob_iter; | 257 std::vector<std::vector<IndexedDBMsg_BlobOrFileInfo> >::iterator blob_iter; |
| 260 for (value_iter = values.begin(), blob_iter = blob_or_file_infos->begin(); | 258 for (value_iter = values.begin(), blob_iter = |
| 261 value_iter != values.end(); | 259 params->blob_or_file_infos.begin(); value_iter != values.end(); |
| 262 ++value_iter, ++blob_iter) { | 260 ++value_iter, ++blob_iter) { |
| 263 if (!CreateAllBlobs(value_iter->blob_info, &*blob_iter, dispatcher_host)) | 261 if (!CreateAllBlobs(value_iter->blob_info, &*blob_iter, dispatcher_host)) |
| 264 return; | 262 return; |
| 265 } | 263 } |
| 266 dispatcher_host->Send( | 264 dispatcher_host->Send( |
| 267 new IndexedDBMsg_CallbacksSuccessCursorPrefetch(*params)); | 265 new IndexedDBMsg_CallbacksSuccessCursorPrefetch(*params)); |
| 268 } | 266 } |
| 269 | 267 |
| 270 static void FillInBlobData( | 268 static void FillInBlobData( |
| 271 const std::vector<IndexedDBBlobInfo>& blob_info, | 269 const std::vector<IndexedDBBlobInfo>& blob_info, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 } | 444 } |
| 447 } | 445 } |
| 448 | 446 |
| 449 if (found_blob_info) { | 447 if (found_blob_info) { |
| 450 BrowserThread::PostTask( | 448 BrowserThread::PostTask( |
| 451 BrowserThread::IO, | 449 BrowserThread::IO, |
| 452 FROM_HERE, | 450 FROM_HERE, |
| 453 base::Bind(BlobLookupForCursorPrefetch, | 451 base::Bind(BlobLookupForCursorPrefetch, |
| 454 base::Owned(params.release()), | 452 base::Owned(params.release()), |
| 455 dispatcher_host_, | 453 dispatcher_host_, |
| 456 values, | 454 values)); |
| 457 base::Unretained(¶ms->blob_or_file_infos))); | |
| 458 } else { | 455 } else { |
| 459 dispatcher_host_->Send( | 456 dispatcher_host_->Send( |
| 460 new IndexedDBMsg_CallbacksSuccessCursorPrefetch(*params.get())); | 457 new IndexedDBMsg_CallbacksSuccessCursorPrefetch(*params.get())); |
| 461 } | 458 } |
| 462 dispatcher_host_ = NULL; | 459 dispatcher_host_ = NULL; |
| 463 } | 460 } |
| 464 | 461 |
| 465 void IndexedDBCallbacks::OnSuccess(IndexedDBValue* value, | 462 void IndexedDBCallbacks::OnSuccess(IndexedDBValue* value, |
| 466 const IndexedDBKey& key, | 463 const IndexedDBKey& key, |
| 467 const IndexedDBKeyPath& key_path) { | 464 const IndexedDBKeyPath& key_path) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 DCHECK_EQ(kNoDatabase, ipc_database_id_); | 564 DCHECK_EQ(kNoDatabase, ipc_database_id_); |
| 568 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_); | 565 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_); |
| 569 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); | 566 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); |
| 570 | 567 |
| 571 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessUndefined( | 568 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessUndefined( |
| 572 ipc_thread_id_, ipc_callbacks_id_)); | 569 ipc_thread_id_, ipc_callbacks_id_)); |
| 573 dispatcher_host_ = NULL; | 570 dispatcher_host_ = NULL; |
| 574 } | 571 } |
| 575 | 572 |
| 576 } // namespace content | 573 } // namespace content |
| OLD | NEW |