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

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

Issue 2125213002: [IndexedDB] Propogating changes to observers : Renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lifetime
Patch Set: Minor typecasting Created 4 years, 5 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 long long transaction_id) { 108 long long transaction_id) {
109 IndexedDBDispatcher* dispatcher = 109 IndexedDBDispatcher* dispatcher =
110 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 110 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
111 111
112 int32_t observer_id = dispatcher->AddIDBObserver( 112 int32_t observer_id = dispatcher->AddIDBObserver(
113 ipc_database_id_, transaction_id, std::move(observer)); 113 ipc_database_id_, transaction_id, std::move(observer));
114 observer_ids_.insert(observer_id); 114 observer_ids_.insert(observer_id);
115 return observer_id; 115 return observer_id;
116 } 116 }
117 117
118 bool WebIDBDatabaseImpl::containsObserverId(int32_t id) const {
119 return ContainsValue(observer_ids_, id);
120 }
121
122 void WebIDBDatabaseImpl::removeObservers( 118 void WebIDBDatabaseImpl::removeObservers(
123 const std::vector<int32_t>& observer_ids_to_remove) { 119 const WebVector<int32_t>& observer_ids_to_remove) {
120 std::vector<int32_t> remove_observer_ids(
121 observer_ids_to_remove.data(),
122 observer_ids_to_remove.data() + observer_ids_to_remove.size());
124 for (int32_t id : observer_ids_to_remove) 123 for (int32_t id : observer_ids_to_remove)
125 observer_ids_.erase(id); 124 observer_ids_.erase(id);
126 125
127 IndexedDBDispatcher* dispatcher = 126 IndexedDBDispatcher* dispatcher =
128 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 127 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
129 dispatcher->RemoveIDBObserversFromDatabase(ipc_database_id_, 128 dispatcher->RemoveIDBObserversFromDatabase(ipc_database_id_,
130 observer_ids_to_remove); 129 remove_observer_ids);
131 } 130 }
132 131
133 void WebIDBDatabaseImpl::get(long long transaction_id, 132 void WebIDBDatabaseImpl::get(long long transaction_id,
134 long long object_store_id, 133 long long object_store_id,
135 long long index_id, 134 long long index_id,
136 const WebIDBKeyRange& key_range, 135 const WebIDBKeyRange& key_range,
137 bool key_only, 136 bool key_only,
138 WebIDBCallbacks* callbacks) { 137 WebIDBCallbacks* callbacks) {
139 IndexedDBDispatcher* dispatcher = 138 IndexedDBDispatcher* dispatcher =
140 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 139 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 320
322 void WebIDBDatabaseImpl::ackReceivedBlobs(const WebVector<WebString>& uuids) { 321 void WebIDBDatabaseImpl::ackReceivedBlobs(const WebVector<WebString>& uuids) {
323 DCHECK(uuids.size()); 322 DCHECK(uuids.size());
324 std::vector<std::string> param(uuids.size()); 323 std::vector<std::string> param(uuids.size());
325 for (size_t i = 0; i < uuids.size(); ++i) 324 for (size_t i = 0; i < uuids.size(); ++i)
326 param[i] = uuids[i].latin1().data(); 325 param[i] = uuids[i].latin1().data();
327 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(param)); 326 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(param));
328 } 327 }
329 328
330 } // namespace content 329 } // namespace content
OLDNEW
« no previous file with comments | « content/child/indexed_db/webidbdatabase_impl.h ('k') | content/common/indexed_db/indexed_db_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698