Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 | 28 |
| 29 void VersionChangeIgnored(); | 29 void VersionChangeIgnored(); |
| 30 | 30 |
| 31 virtual void ActivatePendingObservers( | 31 virtual void ActivatePendingObservers( |
| 32 std::vector<std::unique_ptr<IndexedDBObserver>> pending_observers); | 32 std::vector<std::unique_ptr<IndexedDBObserver>> pending_observers); |
| 33 // Removes observer listed in |remove_observer_ids| from active_observer of | 33 // Removes observer listed in |remove_observer_ids| from active_observer of |
| 34 // connection or pending_observer of transactions associated with this | 34 // connection or pending_observer of transactions associated with this |
| 35 // connection. | 35 // connection. |
| 36 virtual void RemoveObservers(const std::vector<int32_t>& remove_observer_ids); | 36 virtual void RemoveObservers(const std::vector<int32_t>& remove_observer_ids); |
| 37 | 37 |
| 38 void setId(int32_t id) { id_ = id; } | |
|
cmumford
2016/07/07 21:14:21
Nit: setId/id are a pair, so I'd eliminate whitesp
palakj1
2016/07/08 17:37:55
Done.
| |
| 39 | |
| 40 int32_t id() const { return id_; } | |
| 38 IndexedDBDatabase* database() const { return database_.get(); } | 41 IndexedDBDatabase* database() const { return database_.get(); } |
| 39 IndexedDBDatabaseCallbacks* callbacks() const { return callbacks_.get(); } | 42 IndexedDBDatabaseCallbacks* callbacks() const { return callbacks_.get(); } |
| 40 const std::vector<std::unique_ptr<IndexedDBObserver>>& active_observers() | 43 const std::vector<std::unique_ptr<IndexedDBObserver>>& active_observers() |
| 41 const { | 44 const { |
| 42 return active_observers_; | 45 return active_observers_; |
| 43 } | 46 } |
| 44 base::WeakPtr<IndexedDBConnection> GetWeakPtr() { | 47 base::WeakPtr<IndexedDBConnection> GetWeakPtr() { |
| 45 return weak_factory_.GetWeakPtr(); | 48 return weak_factory_.GetWeakPtr(); |
| 46 } | 49 } |
| 47 | 50 |
| 48 private: | 51 private: |
| 49 // NULL in some unit tests, and after the connection is closed. | 52 // NULL in some unit tests, and after the connection is closed. |
| 53 int32_t id_; | |
|
cmumford
2016/07/07 21:14:21
id_ got put in between the comment and database_,
palakj1
2016/07/08 17:37:55
Sorry for that. Changed.
| |
| 50 scoped_refptr<IndexedDBDatabase> database_; | 54 scoped_refptr<IndexedDBDatabase> database_; |
| 51 | 55 |
| 52 // The callbacks_ member is cleared when the connection is closed. | 56 // The callbacks_ member is cleared when the connection is closed. |
| 53 // May be NULL in unit tests. | 57 // May be NULL in unit tests. |
| 54 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_; | 58 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_; |
| 55 std::vector<std::unique_ptr<IndexedDBObserver>> active_observers_; | 59 std::vector<std::unique_ptr<IndexedDBObserver>> active_observers_; |
| 56 base::WeakPtrFactory<IndexedDBConnection> weak_factory_; | 60 base::WeakPtrFactory<IndexedDBConnection> weak_factory_; |
| 57 | 61 |
| 58 DISALLOW_COPY_AND_ASSIGN(IndexedDBConnection); | 62 DISALLOW_COPY_AND_ASSIGN(IndexedDBConnection); |
| 59 }; | 63 }; |
| 60 | 64 |
| 61 } // namespace content | 65 } // namespace content |
| 62 | 66 |
| 63 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ | 67 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ |
| OLD | NEW |