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 #include "content/browser/indexed_db/indexed_db_connection.h" | 5 #include "content/browser/indexed_db/indexed_db_connection.h" |
6 | 6 |
7 namespace content { | 7 namespace content { |
8 | 8 |
9 IndexedDBConnection::IndexedDBConnection( | 9 IndexedDBConnection::IndexedDBConnection( |
10 scoped_refptr<IndexedDBDatabase> database, | 10 scoped_refptr<IndexedDBDatabase> database, |
11 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks) | 11 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks) |
12 : database_(database), callbacks_(callbacks) {} | 12 : database_(database), callbacks_(callbacks) {} |
13 | 13 |
14 IndexedDBConnection::~IndexedDBConnection() {} | 14 IndexedDBConnection::~IndexedDBConnection() {} |
15 | 15 |
16 void IndexedDBConnection::Close() { | 16 void IndexedDBConnection::Close() { |
17 if (!callbacks_) | 17 if (!callbacks_.get()) |
18 return; | 18 return; |
19 database_->Close(this, false /* forced */); | 19 database_->Close(this, false /* forced */); |
20 database_ = NULL; | 20 database_ = NULL; |
21 callbacks_ = NULL; | 21 callbacks_ = NULL; |
22 } | 22 } |
23 | 23 |
24 void IndexedDBConnection::ForceClose() { | 24 void IndexedDBConnection::ForceClose() { |
25 if (!callbacks_) | 25 if (!callbacks_.get()) |
26 return; | 26 return; |
27 database_->Close(this, true /* forced */); | 27 database_->Close(this, true /* forced */); |
28 database_ = NULL; | 28 database_ = NULL; |
29 callbacks_->OnForcedClose(); | 29 callbacks_->OnForcedClose(); |
30 callbacks_ = NULL; | 30 callbacks_ = NULL; |
31 } | 31 } |
32 | 32 |
33 void IndexedDBConnection::VersionChangeIgnored() { | 33 void IndexedDBConnection::VersionChangeIgnored() { |
34 if (!database_) | 34 if (!database_.get()) |
35 return; | 35 return; |
36 database_->VersionChangeIgnored(); | 36 database_->VersionChangeIgnored(); |
37 } | 37 } |
38 | 38 |
39 bool IndexedDBConnection::IsConnected() { | 39 bool IndexedDBConnection::IsConnected() { |
40 return database_.get() != NULL; | 40 return database_.get() != NULL; |
41 } | 41 } |
42 | 42 |
43 } // namespace content | 43 } // namespace content |
OLD | NEW |