OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/database_impl.h" | 5 #include "content/browser/indexed_db/database_impl.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 280 |
281 std::vector<std::unique_ptr<storage::BlobDataHandle>> handles( | 281 std::vector<std::unique_ptr<storage::BlobDataHandle>> handles( |
282 value->blob_or_file_info.size()); | 282 value->blob_or_file_info.size()); |
283 std::vector<IndexedDBBlobInfo> blob_info(value->blob_or_file_info.size()); | 283 std::vector<IndexedDBBlobInfo> blob_info(value->blob_or_file_info.size()); |
284 for (size_t i = 0; i < value->blob_or_file_info.size(); ++i) { | 284 for (size_t i = 0; i < value->blob_or_file_info.size(); ++i) { |
285 ::indexed_db::mojom::BlobInfoPtr& info = value->blob_or_file_info[i]; | 285 ::indexed_db::mojom::BlobInfoPtr& info = value->blob_or_file_info[i]; |
286 | 286 |
287 std::unique_ptr<storage::BlobDataHandle> handle = | 287 std::unique_ptr<storage::BlobDataHandle> handle = |
288 dispatcher_host_->blob_storage_context()->GetBlobDataFromUUID( | 288 dispatcher_host_->blob_storage_context()->GetBlobDataFromUUID( |
289 info->uuid); | 289 info->uuid); |
| 290 dispatcher_host_->AckBlobRecievedFromIDB(info->uuid); |
290 | 291 |
291 // Due to known issue crbug.com/351753, blobs can die while being passed to | 292 // Due to known issue crbug.com/351753, blobs can die while being passed to |
292 // a different process. So this case must be handled gracefully. | 293 // a different process. So this case must be handled gracefully. |
293 // TODO(dmurph): Revert back to using mojo::ReportBadMessage once fixed. | 294 // TODO(dmurph): Revert back to using mojo::ReportBadMessage once fixed. |
294 UMA_HISTOGRAM_BOOLEAN("Storage.IndexedDB.PutValidBlob", | 295 UMA_HISTOGRAM_BOOLEAN("Storage.IndexedDB.PutValidBlob", |
295 handle.get() != nullptr); | 296 handle.get() != nullptr); |
296 if (!handle) { | 297 if (!handle) { |
297 IndexedDBDatabaseError error(blink::kWebIDBDatabaseExceptionUnknownError, | 298 IndexedDBDatabaseError error(blink::kWebIDBDatabaseExceptionUnknownError, |
298 kInvalidBlobUuid); | 299 kInvalidBlobUuid); |
299 idb_runner_->PostTask(FROM_HERE, base::Bind(&IndexedDBCallbacks::OnError, | 300 idb_runner_->PostTask(FROM_HERE, base::Bind(&IndexedDBCallbacks::OnError, |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 usage + transaction->size() <= quota) { | 914 usage + transaction->size() <= quota) { |
914 connection_->database()->Commit(transaction); | 915 connection_->database()->Commit(transaction); |
915 } else { | 916 } else { |
916 connection_->AbortTransaction( | 917 connection_->AbortTransaction( |
917 transaction, | 918 transaction, |
918 IndexedDBDatabaseError(blink::kWebIDBDatabaseExceptionQuotaError)); | 919 IndexedDBDatabaseError(blink::kWebIDBDatabaseExceptionQuotaError)); |
919 } | 920 } |
920 } | 921 } |
921 | 922 |
922 } // namespace content | 923 } // namespace content |
OLD | NEW |