summaryrefslogtreecommitdiffstats
path: root/content/browser/indexed_db/indexed_db_transaction.h
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-25 15:52:21 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-25 15:52:21 +0000
commit45c56d58e1fa736d57fb8bc9deaed44123386ade (patch)
treee95daacf0a64e86b2e5e26eae3e93cc54f2b5d5a /content/browser/indexed_db/indexed_db_transaction.h
parentfa9488c4e362d6e649df95bb55ce75b13a7f5fd6 (diff)
downloadchromium_src-45c56d58e1fa736d57fb8bc9deaed44123386ade.zip
chromium_src-45c56d58e1fa736d57fb8bc9deaed44123386ade.tar.gz
chromium_src-45c56d58e1fa736d57fb8bc9deaed44123386ade.tar.bz2
Revert 202215 "Migrate the IndexedDB backend from Blink to Chromium"
> Migrate the IndexedDB backend from Blink to Chromium > > To get the IDB backend off the (deprecated) WebKit thread, remove > intermediate proxying, and let us take advantage of base utilities, > we're moving the code from Blink to Chromium. > > This patch is basically a glorified copy/paste of the Blink IDB > backend code, with Chromium coding style applied, WTF dependencies > replaced with STL and base/, redundant classes removed, etc. It > introduces some new temporary proxy classes > (content/browser/webidb*_impl.*) to allow us build both the old and > new backends. > > The new backend is currently disabled by default. It can be enabled > using a new (and temporary) command line switch: --new-indexeddb Once > we've done some further cleanup and are confident that the new backend > is stable, and the bots have moved from DumpRenderTree to > content_shell, we'll switch to the new backend by default. Once that > has survived through a dev channel release, we'll delete the Blink > code and eliminate unnecessary proxy classes. > > BUG=234278 > R=alecflett@chromium.org, dgrogan@chromium.org, piman@chromium.org > > Review URL: https://codereview.chromium.org/15564008 TBR=jsbell@chromium.org Review URL: https://codereview.chromium.org/15870003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202302 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/indexed_db/indexed_db_transaction.h')
-rw-r--r--content/browser/indexed_db/indexed_db_transaction.h150
1 files changed, 0 insertions, 150 deletions
diff --git a/content/browser/indexed_db/indexed_db_transaction.h b/content/browser/indexed_db/indexed_db_transaction.h
deleted file mode 100644
index ca0f929..0000000
--- a/content/browser/indexed_db/indexed_db_transaction.h
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_
-#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_
-
-#include <queue>
-#include <set>
-#include <stack>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/timer.h"
-#include "content/browser/indexed_db/indexed_db_backing_store.h"
-#include "content/browser/indexed_db/indexed_db_database.h"
-#include "content/browser/indexed_db/indexed_db_database_error.h"
-
-namespace content {
-
-class IndexedDBDatabaseImpl;
-class IndexedDBCursorImpl;
-class IndexedDBDatabaseCallbacksWrapper;
-
-class IndexedDBTransaction : public base::RefCounted<IndexedDBTransaction> {
- public:
- static scoped_refptr<IndexedDBTransaction> Create(
- int64 transaction_id,
- scoped_refptr<IndexedDBDatabaseCallbacksWrapper> callbacks,
- const std::vector<int64>& scope,
- indexed_db::TransactionMode,
- IndexedDBDatabaseImpl* db);
-
- virtual void Abort();
- void Commit();
-
- class Operation {
- public:
- Operation() {}
- virtual ~Operation() {}
- virtual void Perform(IndexedDBTransaction* transaction) = 0;
- };
-
- void Abort(scoped_refptr<IndexedDBDatabaseError> error);
- void Run();
- indexed_db::TransactionMode mode() const { return mode_; }
- const std::set<int64>& scope() const { return object_store_ids_; }
- void ScheduleTask(Operation* task, Operation* abort_task = NULL) {
- ScheduleTask(IndexedDBDatabase::NORMAL_TASK, task, abort_task);
- }
- void ScheduleTask(IndexedDBDatabase::TaskType,
- Operation* task,
- Operation* abort_task = NULL);
- void RegisterOpenCursor(IndexedDBCursorImpl* cursor);
- void UnregisterOpenCursor(IndexedDBCursorImpl* cursor);
- void AddPreemptiveEvent() { pending_preemptive_events_++; }
- void DidCompletePreemptiveEvent() {
- pending_preemptive_events_--;
- DCHECK_GE(pending_preemptive_events_, 0);
- }
- IndexedDBBackingStore::Transaction* BackingStoreTransaction() {
- return &transaction_;
- }
- int64 id() const { return id_; }
-
- IndexedDBDatabaseImpl* database() const { return database_.get(); }
- IndexedDBDatabaseCallbacksWrapper* connection() const {
- return callbacks_.get();
- }
-
- protected:
- virtual ~IndexedDBTransaction();
- friend class base::RefCounted<IndexedDBTransaction>;
-
- private:
- IndexedDBTransaction(
- int64 id,
- scoped_refptr<IndexedDBDatabaseCallbacksWrapper> callbacks,
- const std::set<int64>& object_store_ids,
- indexed_db::TransactionMode,
- IndexedDBDatabaseImpl* db);
-
- enum State {
- UNUSED, // Created, but no tasks yet.
- START_PENDING, // Enqueued tasks, but backing store transaction not yet
- // started.
- RUNNING, // Backing store transaction started but not yet finished.
- FINISHED, // Either aborted or committed.
- };
-
- void Start();
-
- bool IsTaskQueueEmpty() const;
- bool HasPendingTasks() const;
-
- void TaskTimerFired();
- void CloseOpenCursors();
-
- const int64 id_;
- const std::set<int64> object_store_ids_;
- const indexed_db::TransactionMode mode_;
-
- State state_;
- bool commit_pending_;
- scoped_refptr<IndexedDBDatabaseCallbacksWrapper> callbacks_;
- scoped_refptr<IndexedDBDatabaseImpl> database_;
-
- class TaskQueue {
- public:
- TaskQueue();
- ~TaskQueue();
- bool empty() const { return queue_.empty(); }
- void push(Operation* task) { queue_.push(task); }
- scoped_ptr<Operation> pop();
- void clear();
-
- private:
- std::queue<Operation*> queue_;
- };
-
- class TaskStack {
- public:
- TaskStack();
- ~TaskStack();
- bool empty() const { return stack_.empty(); }
- void push(Operation* task) { stack_.push(task); }
- scoped_ptr<Operation> pop();
- void clear();
-
- private:
- std::stack<Operation*> stack_;
- };
-
- TaskQueue task_queue_;
- TaskQueue preemptive_task_queue_;
- TaskStack abort_task_stack_;
-
- IndexedDBBackingStore::Transaction transaction_;
-
- base::OneShotTimer<IndexedDBTransaction> task_timer_;
- int pending_preemptive_events_;
-
- std::set<IndexedDBCursorImpl*> open_cursors_;
-};
-
-} // namespace content
-
-#endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_