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

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

Issue 2160163002: [IndexedDB] Propogating Changes to Observer : Browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Expected tests updated 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/browser/indexed_db/indexed_db_connection.h" 5 #include "content/browser/indexed_db/indexed_db_connection.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 IndexedDBConnection::IndexedDBConnection( 12 IndexedDBConnection::IndexedDBConnection(
13 scoped_refptr<IndexedDBDatabase> database, 13 scoped_refptr<IndexedDBDatabase> database,
14 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks) 14 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks)
15 : database_(database), callbacks_(callbacks), weak_factory_(this) {} 15 : database_(database), callbacks_(callbacks), weak_factory_(this) {}
16 16
17 IndexedDBConnection::~IndexedDBConnection() {} 17 IndexedDBConnection::~IndexedDBConnection() {}
18 18
19 void IndexedDBConnection::set_id(int32_t id) {
20 DCHECK_EQ(id_, kInvalidId);
21 id_ = id;
22 }
23
19 void IndexedDBConnection::Close() { 24 void IndexedDBConnection::Close() {
20 if (!callbacks_.get()) 25 if (!callbacks_.get())
21 return; 26 return;
22 base::WeakPtr<IndexedDBConnection> this_obj = weak_factory_.GetWeakPtr(); 27 base::WeakPtr<IndexedDBConnection> this_obj = weak_factory_.GetWeakPtr();
23 database_->Close(this, false /* forced */); 28 database_->Close(this, false /* forced */);
24 if (this_obj) { 29 if (this_obj) {
25 database_ = nullptr; 30 database_ = nullptr;
26 callbacks_ = nullptr; 31 callbacks_ = nullptr;
27 active_observers_.clear(); 32 active_observers_.clear();
28 } 33 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 if (it != active_observers_.end()) 80 if (it != active_observers_.end())
76 active_observers_.erase(it); 81 active_observers_.erase(it);
77 else 82 else
78 pending_observer_ids.push_back(id_to_remove); 83 pending_observer_ids.push_back(id_to_remove);
79 } 84 }
80 if (!pending_observer_ids.empty()) 85 if (!pending_observer_ids.empty())
81 database_->RemovePendingObservers(this, pending_observer_ids); 86 database_->RemovePendingObservers(this, pending_observer_ids);
82 } 87 }
83 88
84 } // namespace content 89 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_connection.h ('k') | content/browser/indexed_db/indexed_db_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698