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

Side by Side Diff: content/browser/indexed_db/indexed_db_callbacks.cc

Issue 2125213002: [IndexedDB] Propogating changes to observers : Renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lifetime
Patch Set: Filtering Changes to Observer : Browser End 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/indexed_db_callbacks.h" 5 #include "content/browser/indexed_db/indexed_db_callbacks.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 std::unique_ptr<IndexedDBConnection> connection, 154 std::unique_ptr<IndexedDBConnection> connection,
155 const IndexedDBDatabaseMetadata& metadata) { 155 const IndexedDBDatabaseMetadata& metadata) {
156 DCHECK(dispatcher_host_.get()); 156 DCHECK(dispatcher_host_.get());
157 157
158 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 158 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
159 DCHECK_NE(kNoTransaction, host_transaction_id_); 159 DCHECK_NE(kNoTransaction, host_transaction_id_);
160 DCHECK_EQ(kNoDatabase, ipc_database_id_); 160 DCHECK_EQ(kNoDatabase, ipc_database_id_);
161 DCHECK_NE(kNoDatabaseCallbacks, ipc_database_callbacks_id_); 161 DCHECK_NE(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
162 162
163 dispatcher_host_->RegisterTransactionId(host_transaction_id_, origin_); 163 dispatcher_host_->RegisterTransactionId(host_transaction_id_, origin_);
164 IndexedDBConnection* connection_ptr = connection.get();
164 int32_t ipc_database_id = 165 int32_t ipc_database_id =
165 dispatcher_host_->Add(connection.release(), ipc_thread_id_, origin_); 166 dispatcher_host_->Add(connection.release(), ipc_thread_id_, origin_);
167 connection_ptr->setId(ipc_database_id);
168
166 if (ipc_database_id < 0) 169 if (ipc_database_id < 0)
167 return; 170 return;
168 ipc_database_id_ = ipc_database_id; 171 ipc_database_id_ = ipc_database_id;
169 IndexedDBMsg_CallbacksUpgradeNeeded_Params params; 172 IndexedDBMsg_CallbacksUpgradeNeeded_Params params;
170 params.ipc_thread_id = ipc_thread_id_; 173 params.ipc_thread_id = ipc_thread_id_;
171 params.ipc_callbacks_id = ipc_callbacks_id_; 174 params.ipc_callbacks_id = ipc_callbacks_id_;
172 params.ipc_database_id = ipc_database_id; 175 params.ipc_database_id = ipc_database_id;
173 params.ipc_database_callbacks_id = ipc_database_callbacks_id_; 176 params.ipc_database_callbacks_id = ipc_database_callbacks_id_;
174 params.old_version = old_version; 177 params.old_version = old_version;
175 params.idb_metadata = IndexedDBDispatcherHost::ConvertMetadata(metadata); 178 params.idb_metadata = IndexedDBDispatcherHost::ConvertMetadata(metadata);
(...skipping 17 matching lines...) Expand all
193 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 196 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
194 DCHECK_NE(kNoTransaction, host_transaction_id_); 197 DCHECK_NE(kNoTransaction, host_transaction_id_);
195 DCHECK_NE(ipc_database_id_ == kNoDatabase, !connection); 198 DCHECK_NE(ipc_database_id_ == kNoDatabase, !connection);
196 DCHECK_NE(kNoDatabaseCallbacks, ipc_database_callbacks_id_); 199 DCHECK_NE(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
197 200
198 scoped_refptr<IndexedDBCallbacks> self(this); 201 scoped_refptr<IndexedDBCallbacks> self(this);
199 202
200 int32_t ipc_object_id = kNoDatabase; 203 int32_t ipc_object_id = kNoDatabase;
201 // Only register if the connection was not previously sent in OnUpgradeNeeded. 204 // Only register if the connection was not previously sent in OnUpgradeNeeded.
202 if (ipc_database_id_ == kNoDatabase) { 205 if (ipc_database_id_ == kNoDatabase) {
206 IndexedDBConnection* connection_ptr = connection.get();
203 ipc_object_id = 207 ipc_object_id =
204 dispatcher_host_->Add(connection.release(), ipc_thread_id_, origin_); 208 dispatcher_host_->Add(connection.release(), ipc_thread_id_, origin_);
209 connection_ptr->setId(ipc_object_id);
cmumford 2016/07/07 21:14:21 IndexedDBDispatcherHost::Add() will delete connect
205 } 210 }
206
207 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessIDBDatabase( 211 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessIDBDatabase(
208 ipc_thread_id_, 212 ipc_thread_id_,
209 ipc_callbacks_id_, 213 ipc_callbacks_id_,
210 ipc_database_callbacks_id_, 214 ipc_database_callbacks_id_,
211 ipc_object_id, 215 ipc_object_id,
212 IndexedDBDispatcherHost::ConvertMetadata(metadata))); 216 IndexedDBDispatcherHost::ConvertMetadata(metadata)));
213 dispatcher_host_ = NULL; 217 dispatcher_host_ = NULL;
214 218
215 if (!connection_open_start_time_.is_null()) { 219 if (!connection_open_start_time_.is_null()) {
216 UMA_HISTOGRAM_MEDIUM_TIMES( 220 UMA_HISTOGRAM_MEDIUM_TIMES(
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 ipc_thread_id_, ipc_callbacks_id_)); 611 ipc_thread_id_, ipc_callbacks_id_));
608 dispatcher_host_ = NULL; 612 dispatcher_host_ = NULL;
609 } 613 }
610 614
611 void IndexedDBCallbacks::SetConnectionOpenStartTime( 615 void IndexedDBCallbacks::SetConnectionOpenStartTime(
612 const base::TimeTicks& start_time) { 616 const base::TimeTicks& start_time) {
613 connection_open_start_time_ = start_time; 617 connection_open_start_time_ = start_time;
614 } 618 }
615 619
616 } // namespace content 620 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_connection.h » ('j') | content/browser/indexed_db/indexed_db_connection.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698