Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 #include "core/dom/DOMStringList.h" | 36 #include "core/dom/DOMStringList.h" |
| 37 #include "core/dom/ExceptionCode.h" | 37 #include "core/dom/ExceptionCode.h" |
| 38 #include "core/dom/ExecutionContext.h" | 38 #include "core/dom/ExecutionContext.h" |
| 39 #include "modules/indexeddb/IDBAny.h" | 39 #include "modules/indexeddb/IDBAny.h" |
| 40 #include "modules/indexeddb/IDBCursorWithValue.h" | 40 #include "modules/indexeddb/IDBCursorWithValue.h" |
| 41 #include "modules/indexeddb/IDBDatabase.h" | 41 #include "modules/indexeddb/IDBDatabase.h" |
| 42 #include "modules/indexeddb/IDBKeyPath.h" | 42 #include "modules/indexeddb/IDBKeyPath.h" |
| 43 #include "modules/indexeddb/IDBTracing.h" | 43 #include "modules/indexeddb/IDBTracing.h" |
| 44 #include "platform/Histogram.h" | 44 #include "platform/Histogram.h" |
| 45 #include "platform/SharedBuffer.h" | 45 #include "platform/SharedBuffer.h" |
| 46 #include "public/platform/Platform.h" | |
| 46 #include "public/platform/WebBlobInfo.h" | 47 #include "public/platform/WebBlobInfo.h" |
| 48 #include "public/platform/WebBlobRegistry.h" | |
| 47 #include "public/platform/WebData.h" | 49 #include "public/platform/WebData.h" |
| 48 #include "public/platform/WebVector.h" | 50 #include "public/platform/WebVector.h" |
| 49 #include "public/platform/modules/indexeddb/WebIDBKey.h" | 51 #include "public/platform/modules/indexeddb/WebIDBKey.h" |
| 50 #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" | 52 #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" |
| 51 #include "v8/include/v8.h" | 53 #include "v8/include/v8.h" |
| 52 | 54 |
| 53 using blink::WebBlobInfo; | 55 using blink::WebBlobInfo; |
| 54 using blink::WebIDBCallbacks; | 56 using blink::WebIDBCallbacks; |
| 55 using blink::WebIDBCursor; | 57 using blink::WebIDBCursor; |
| 56 using blink::WebIDBDatabase; | 58 using blink::WebIDBDatabase; |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 index_ids.push_back(it.key); | 501 index_ids.push_back(it.key); |
| 500 index_keys.push_back(keys); | 502 index_keys.push_back(keys); |
| 501 } | 503 } |
| 502 | 504 |
| 503 IDBRequest* request = | 505 IDBRequest* request = |
| 504 IDBRequest::Create(script_state, source, transaction_.Get()); | 506 IDBRequest::Create(script_state, source, transaction_.Get()); |
| 505 Vector<char> wire_bytes; | 507 Vector<char> wire_bytes; |
| 506 serialized_value->ToWireBytes(wire_bytes); | 508 serialized_value->ToWireBytes(wire_bytes); |
| 507 RefPtr<SharedBuffer> value_buffer = SharedBuffer::AdoptVector(wire_bytes); | 509 RefPtr<SharedBuffer> value_buffer = SharedBuffer::AdoptVector(wire_bytes); |
| 508 | 510 |
| 511 // Add blob refs | |
| 512 blink::Platform* platform = blink::Platform::Current(); | |
| 513 DCHECK(platform); | |
| 514 blink::WebBlobRegistry* registry = platform->GetBlobRegistry(); | |
| 515 DCHECK(registry); | |
| 516 for (const WebBlobInfo& info : blob_info) { | |
| 517 registry->AddBlobDataRef(info.Uuid()); | |
|
michaeln
2017/04/21 01:46:10
Manual refcounting always makes me a little uneasy
| |
| 518 } | |
| 519 | |
| 509 BackendDB()->Put(transaction_->Id(), Id(), WebData(value_buffer), blob_info, | 520 BackendDB()->Put(transaction_->Id(), Id(), WebData(value_buffer), blob_info, |
| 510 key, static_cast<WebIDBPutMode>(put_mode), | 521 key, static_cast<WebIDBPutMode>(put_mode), |
| 511 request->CreateWebCallbacks().release(), index_ids, | 522 request->CreateWebCallbacks().release(), index_ids, |
| 512 index_keys); | 523 index_keys); |
| 513 return request; | 524 return request; |
| 514 } | 525 } |
| 515 | 526 |
| 516 IDBRequest* IDBObjectStore::deleteFunction(ScriptState* script_state, | 527 IDBRequest* IDBObjectStore::deleteFunction(ScriptState* script_state, |
| 517 const ScriptValue& key, | 528 const ScriptValue& key, |
| 518 ExceptionState& exception_state) { | 529 ExceptionState& exception_state) { |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1052 } | 1063 } |
| 1053 } | 1064 } |
| 1054 return IDBIndexMetadata::kInvalidId; | 1065 return IDBIndexMetadata::kInvalidId; |
| 1055 } | 1066 } |
| 1056 | 1067 |
| 1057 WebIDBDatabase* IDBObjectStore::BackendDB() const { | 1068 WebIDBDatabase* IDBObjectStore::BackendDB() const { |
| 1058 return transaction_->BackendDB(); | 1069 return transaction_->BackendDB(); |
| 1059 } | 1070 } |
| 1060 | 1071 |
| 1061 } // namespace blink | 1072 } // namespace blink |
| OLD | NEW |