Revert 268405 "Make sure that ScratchBuffer::Allocate() always r..."
[chromium-blink-merge.git] / content / browser / indexed_db / indexed_db_connection.h
blobe4ed928257d4dae5529beb42253431f5a08e90c8
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_
8 #include "base/memory/ref_counted.h"
9 #include "content/browser/indexed_db/indexed_db_database.h"
10 #include "content/browser/indexed_db/indexed_db_database_callbacks.h"
12 namespace content {
13 class IndexedDBCallbacks;
14 class IndexedDBDatabaseError;
16 class CONTENT_EXPORT IndexedDBConnection {
17 public:
18 IndexedDBConnection(scoped_refptr<IndexedDBDatabase> db,
19 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks);
20 virtual ~IndexedDBConnection();
22 // These methods are virtual to allow subclassing in unit tests.
23 virtual void ForceClose();
24 virtual void Close();
25 virtual bool IsConnected();
27 IndexedDBDatabase* database() { return database_; }
28 IndexedDBDatabaseCallbacks* callbacks() { return callbacks_; }
30 private:
31 // NULL in some unit tests, and after the connection is closed.
32 scoped_refptr<IndexedDBDatabase> database_;
34 // The callbacks_ member is cleared when the connection is closed.
35 // May be NULL in unit tests.
36 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_;
39 } // namespace content
41 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_