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

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 bugs fixed 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 std::vector<int32_t>& observer_ids_to_remove) {
124 for (int32_t id : observer_ids_to_remove) 120 for (int32_t id : observer_ids_to_remove)
125 observer_ids_.erase(id); 121 observer_ids_.erase(id);
126 122
127 IndexedDBDispatcher* dispatcher = 123 IndexedDBDispatcher* dispatcher =
128 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 124 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
129 dispatcher->RemoveIDBObserversFromDatabase(ipc_database_id_, 125 dispatcher->RemoveIDBObserversFromDatabase(ipc_database_id_,
130 observer_ids_to_remove); 126 observer_ids_to_remove);
131 } 127 }
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 317
322 void WebIDBDatabaseImpl::ackReceivedBlobs(const WebVector<WebString>& uuids) { 318 void WebIDBDatabaseImpl::ackReceivedBlobs(const WebVector<WebString>& uuids) {
323 DCHECK(uuids.size()); 319 DCHECK(uuids.size());
324 std::vector<std::string> param(uuids.size()); 320 std::vector<std::string> param(uuids.size());
325 for (size_t i = 0; i < uuids.size(); ++i) 321 for (size_t i = 0; i < uuids.size(); ++i)
326 param[i] = uuids[i].latin1().data(); 322 param[i] = uuids[i].latin1().data();
327 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(param)); 323 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(param));
328 } 324 }
329 325
330 } // namespace content 326 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698