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

Side by Side Diff: content/child/indexed_db/webidbdatabase_impl.cc

Issue 2370643004: Port messages sent by WebIDBFactoryImpl to Mojo. (Closed)
Patch Set: Address last nits and fix leaks in unit tests. Created 4 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/child/indexed_db/webidbdatabase_impl.h" 5 #include "content/child/indexed_db/webidbdatabase_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 19 matching lines...) Expand all
30 using blink::WebIDBKey; 30 using blink::WebIDBKey;
31 using blink::WebIDBKeyPath; 31 using blink::WebIDBKeyPath;
32 using blink::WebIDBKeyRange; 32 using blink::WebIDBKeyRange;
33 using blink::WebIDBObserver; 33 using blink::WebIDBObserver;
34 using blink::WebString; 34 using blink::WebString;
35 using blink::WebVector; 35 using blink::WebVector;
36 36
37 namespace content { 37 namespace content {
38 38
39 WebIDBDatabaseImpl::WebIDBDatabaseImpl(int32_t ipc_database_id, 39 WebIDBDatabaseImpl::WebIDBDatabaseImpl(int32_t ipc_database_id,
40 int32_t ipc_database_callbacks_id,
41 ThreadSafeSender* thread_safe_sender) 40 ThreadSafeSender* thread_safe_sender)
42 : ipc_database_id_(ipc_database_id), 41 : ipc_database_id_(ipc_database_id),
43 ipc_database_callbacks_id_(ipc_database_callbacks_id),
44 thread_safe_sender_(thread_safe_sender) {} 42 thread_safe_sender_(thread_safe_sender) {}
45 43
46 WebIDBDatabaseImpl::~WebIDBDatabaseImpl() { 44 WebIDBDatabaseImpl::~WebIDBDatabaseImpl() {
47 // It's not possible for there to be pending callbacks that address this 45 // It's not possible for there to be pending callbacks that address this
48 // object since inside WebKit, they hold a reference to the object which owns 46 // object since inside WebKit, they hold a reference to the object which owns
49 // this object. But, if that ever changed, then we'd need to invalidate 47 // this object. But, if that ever changed, then we'd need to invalidate
50 // any such pointers. 48 // any such pointers.
51 thread_safe_sender_->Send( 49 thread_safe_sender_->Send(
52 new IndexedDBHostMsg_DatabaseDestroyed(ipc_database_id_)); 50 new IndexedDBHostMsg_DatabaseDestroyed(ipc_database_id_));
53 IndexedDBDispatcher* dispatcher = 51 IndexedDBDispatcher* dispatcher =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 IndexedDBDispatcher* dispatcher = 90 IndexedDBDispatcher* dispatcher =
93 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 91 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
94 dispatcher->RequestIDBDatabaseCreateTransaction( 92 dispatcher->RequestIDBDatabaseCreateTransaction(
95 ipc_database_id_, transaction_id, object_store_ids, mode); 93 ipc_database_id_, transaction_id, object_store_ids, mode);
96 } 94 }
97 95
98 void WebIDBDatabaseImpl::close() { 96 void WebIDBDatabaseImpl::close() {
99 IndexedDBDispatcher* dispatcher = 97 IndexedDBDispatcher* dispatcher =
100 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 98 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
101 dispatcher->RemoveIDBObservers(observer_ids_); 99 dispatcher->RemoveIDBObservers(observer_ids_);
102 dispatcher->RequestIDBDatabaseClose(ipc_database_id_, 100 dispatcher->RequestIDBDatabaseClose(ipc_database_id_);
103 ipc_database_callbacks_id_);
104 } 101 }
105 102
106 void WebIDBDatabaseImpl::versionChangeIgnored() { 103 void WebIDBDatabaseImpl::versionChangeIgnored() {
107 IndexedDBDispatcher* dispatcher = 104 IndexedDBDispatcher* dispatcher =
108 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 105 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
109 dispatcher->NotifyIDBDatabaseVersionChangeIgnored(ipc_database_id_); 106 dispatcher->NotifyIDBDatabaseVersionChangeIgnored(ipc_database_id_);
110 } 107 }
111 108
112 int32_t WebIDBDatabaseImpl::addObserver( 109 int32_t WebIDBDatabaseImpl::addObserver(
113 std::unique_ptr<WebIDBObserver> observer, 110 std::unique_ptr<WebIDBObserver> observer,
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 331
335 void WebIDBDatabaseImpl::ackReceivedBlobs(const WebVector<WebString>& uuids) { 332 void WebIDBDatabaseImpl::ackReceivedBlobs(const WebVector<WebString>& uuids) {
336 DCHECK(uuids.size()); 333 DCHECK(uuids.size());
337 std::vector<std::string> param(uuids.size()); 334 std::vector<std::string> param(uuids.size());
338 for (size_t i = 0; i < uuids.size(); ++i) 335 for (size_t i = 0; i < uuids.size(); ++i)
339 param[i] = uuids[i].latin1().data(); 336 param[i] = uuids[i].latin1().data();
340 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(param)); 337 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(param));
341 } 338 }
342 339
343 } // namespace content 340 } // namespace content
OLDNEW
« no previous file with comments | « content/child/indexed_db/webidbdatabase_impl.h ('k') | content/child/indexed_db/webidbfactory_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698