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

Unified Diff: webkit/dom_storage/dom_storage_session.cc

Issue 9146025: Framing for a DOMStorage backend that does not depend on in-process-webkit. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: webkit/dom_storage/dom_storage_session.cc
===================================================================
--- webkit/dom_storage/dom_storage_session.cc (revision 0)
+++ webkit/dom_storage/dom_storage_session.cc (working copy)
@@ -1,32 +1,47 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
-#include "content/browser/in_process_webkit/session_storage_namespace.h"
+#include "webkit/dom_storage/dom_storage_session.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/logging.h"
-#include "content/browser/in_process_webkit/dom_storage_context.h"
-#include "content/browser/in_process_webkit/webkit_context.h"
+#include "webkit/dom_storage/dom_storage_context.h"
+#include "webkit/dom_storage/dom_storage_task_runner.h"
-SessionStorageNamespace::SessionStorageNamespace(WebKitContext* webkit_context)
- : webkit_context_(webkit_context),
- id_(webkit_context_->dom_storage_context()
- ->AllocateSessionStorageNamespaceId()) {
+namespace dom_storage {
+
+DomStorageSession::DomStorageSession(DomStorageContext* context)
+ : context_(context),
+ namespace_id_(context->AllocateSessionId()) {
+ context->task_runner()->PostTask(
+ FROM_HERE,
+ base::Bind(&DomStorageContext::CreateSessionNamespace,
+ context_, namespace_id_));
}
-SessionStorageNamespace::SessionStorageNamespace(WebKitContext* webkit_context,
- int64 id)
- : webkit_context_(webkit_context),
- id_(id) {
- DCHECK(webkit_context_);
+DomStorageSession* DomStorageSession::Clone() {
+ int64 clone_id = context_->AllocateSessionId();
+ context_->task_runner()->PostTask(
+ FROM_HERE,
+ base::Bind(&DomStorageContext::CloneSessionNamespace,
+ context_, namespace_id_, clone_id));
+ return new DomStorageSession(context_, clone_id);
}
-SessionStorageNamespace::~SessionStorageNamespace() {
- webkit_context_->DeleteSessionStorageNamespace(id_);
+DomStorageSession::DomStorageSession(DomStorageContext* context,
+ int64 namespace_id)
+ : context_(context),
+ namespace_id_(namespace_id) {
+ // This ctor is intended for use by the Clone() method.
}
-SessionStorageNamespace* SessionStorageNamespace::Clone() {
- return new SessionStorageNamespace(
- webkit_context_,
- webkit_context_->dom_storage_context()->CloneSessionStorage(id_));
+DomStorageSession::~DomStorageSession() {
+ context_->task_runner()->PostTask(
+ FROM_HERE,
+ base::Bind(&DomStorageContext::DeleteSessionNamespace,
+ context_, namespace_id_));
}
+
+} // namespace dom_storage

Powered by Google App Engine
This is Rietveld 408576698