diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-24 01:19:43 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-24 01:19:43 +0000 |
commit | adbfb8df4c5d8b870ce5fbeb31d98734315c7f86 (patch) | |
tree | a1061b9593529dfdc2456f66822017efb9abeb31 /content/browser/in_process_webkit | |
parent | 5b3939267794106a44872f14fc8e84699a5a22f6 (diff) | |
download | chromium_src-adbfb8df4c5d8b870ce5fbeb31d98734315c7f86.zip chromium_src-adbfb8df4c5d8b870ce5fbeb31d98734315c7f86.tar.gz chromium_src-adbfb8df4c5d8b870ce5fbeb31d98734315c7f86.tar.bz2 |
Add an API around SessionStorageNamespace. This is just an empty API, what matters to embedders is that they can influence this object's lifetime.
BUG=98716
Review URL: https://chromiumcodereview.appspot.com/9447039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123389 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/in_process_webkit')
-rw-r--r-- | content/browser/in_process_webkit/session_storage_namespace.cc | 32 | ||||
-rw-r--r-- | content/browser/in_process_webkit/session_storage_namespace_impl.cc | 42 | ||||
-rw-r--r-- | content/browser/in_process_webkit/session_storage_namespace_impl.h (renamed from content/browser/in_process_webkit/session_storage_namespace.h) | 32 | ||||
-rw-r--r-- | content/browser/in_process_webkit/webkit_context.cc | 14 | ||||
-rw-r--r-- | content/browser/in_process_webkit/webkit_context.h | 4 |
5 files changed, 56 insertions, 68 deletions
diff --git a/content/browser/in_process_webkit/session_storage_namespace.cc b/content/browser/in_process_webkit/session_storage_namespace.cc deleted file mode 100644 index 03ba9aa..0000000 --- a/content/browser/in_process_webkit/session_storage_namespace.cc +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2011 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 "base/logging.h" -#include "content/browser/in_process_webkit/dom_storage_context_impl.h" -#include "content/browser/in_process_webkit/webkit_context.h" - -SessionStorageNamespace::SessionStorageNamespace(WebKitContext* webkit_context) - : webkit_context_(webkit_context), - id_(webkit_context_->dom_storage_context() - ->AllocateSessionStorageNamespaceId()) { -} - -SessionStorageNamespace::SessionStorageNamespace(WebKitContext* webkit_context, - int64 id) - : webkit_context_(webkit_context), - id_(id) { - DCHECK(webkit_context_); -} - -SessionStorageNamespace::~SessionStorageNamespace() { - webkit_context_->DeleteSessionStorageNamespace(id_); -} - -SessionStorageNamespace* SessionStorageNamespace::Clone() { - return new SessionStorageNamespace( - webkit_context_, - webkit_context_->dom_storage_context()->CloneSessionStorage(id_)); -} diff --git a/content/browser/in_process_webkit/session_storage_namespace_impl.cc b/content/browser/in_process_webkit/session_storage_namespace_impl.cc new file mode 100644 index 0000000..15fe21e --- /dev/null +++ b/content/browser/in_process_webkit/session_storage_namespace_impl.cc @@ -0,0 +1,42 @@ +// Copyright (c) 2011 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_impl.h" + +#include "base/bind.h" +#include "base/logging.h" +#include "content/browser/in_process_webkit/dom_storage_context_impl.h" +#include "content/public/browser/browser_thread.h" + +using content::BrowserThread; + +SessionStorageNamespaceImpl::SessionStorageNamespaceImpl( + DOMStorageContextImpl* context) + : dom_storage_context_(context), + id_(dom_storage_context_->AllocateSessionStorageNamespaceId()) { +} + +SessionStorageNamespaceImpl::SessionStorageNamespaceImpl( + DOMStorageContextImpl* context, int64 id) + : dom_storage_context_(context), + id_(id) { + DCHECK(dom_storage_context_); +} + +SessionStorageNamespaceImpl::~SessionStorageNamespaceImpl() { + if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED) && + BrowserThread::PostTask( + BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, + base::Bind(&DOMStorageContextImpl::DeleteSessionStorageNamespace, + dom_storage_context_, id_))) { + return; + } + + dom_storage_context_->DeleteSessionStorageNamespace(id_); +} + +SessionStorageNamespaceImpl* SessionStorageNamespaceImpl::Clone() { + return new SessionStorageNamespaceImpl( + dom_storage_context_, dom_storage_context_->CloneSessionStorage(id_)); +} diff --git a/content/browser/in_process_webkit/session_storage_namespace.h b/content/browser/in_process_webkit/session_storage_namespace_impl.h index 47e6f32..72f99c8 100644 --- a/content/browser/in_process_webkit/session_storage_namespace.h +++ b/content/browser/in_process_webkit/session_storage_namespace_impl.h @@ -2,24 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_SESSION_STORAGE_NAMESPACE_H_ -#define CONTENT_BROWSER_IN_PROCESS_WEBKIT_SESSION_STORAGE_NAMESPACE_H_ +#ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_SESSION_STORAGE_NAMESPACE_IMPL_H_ +#define CONTENT_BROWSER_IN_PROCESS_WEBKIT_SESSION_STORAGE_NAMESPACE_IMPL_H_ #pragma once #include "base/basictypes.h" +#include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "content/common/content_export.h" +#include "content/public/browser/session_storage_namespace.h" -class WebKitContext; +class DOMStorageContextImpl; -// This is a ref-counted class that represents a SessionStorageNamespace. -// On destruction it ensures that the storage namespace is destroyed. -// NOTE: That if we're shutting down, we don't strictly need to do this, but -// it keeps valgrind happy. -class SessionStorageNamespace - : public base::RefCountedThreadSafe<SessionStorageNamespace> { +class SessionStorageNamespaceImpl + : NON_EXPORTED_BASE(public content::SessionStorageNamespace) { public: - explicit SessionStorageNamespace(WebKitContext* context); + explicit SessionStorageNamespaceImpl(DOMStorageContextImpl* context); int64 id() const { return id_; } @@ -27,20 +25,18 @@ class SessionStorageNamespace // tab contentses to share the same session storage (part of the WebStorage // spec) space. Passing in NULL simply allocates a new one which is often the // correct thing to do (especially in tests. - SessionStorageNamespace* Clone(); + SessionStorageNamespaceImpl* Clone(); private: - SessionStorageNamespace(WebKitContext* webkit_context, int64 id); + SessionStorageNamespaceImpl(DOMStorageContextImpl* context, int64 id); + virtual ~SessionStorageNamespaceImpl(); - friend class base::RefCountedThreadSafe<SessionStorageNamespace>; - CONTENT_EXPORT ~SessionStorageNamespace(); - - scoped_refptr<WebKitContext> webkit_context_; + scoped_refptr<DOMStorageContextImpl> dom_storage_context_; // The session storage namespace id. int64 id_; - DISALLOW_IMPLICIT_CONSTRUCTORS(SessionStorageNamespace); + DISALLOW_COPY_AND_ASSIGN(SessionStorageNamespaceImpl); }; -#endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_SESSION_STORAGE_NAMESPACE_H_ +#endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_SESSION_STORAGE_NAMESPACE_IMPL_H_ diff --git a/content/browser/in_process_webkit/webkit_context.cc b/content/browser/in_process_webkit/webkit_context.cc index 8f116d8..c4df675 100644 --- a/content/browser/in_process_webkit/webkit_context.cc +++ b/content/browser/in_process_webkit/webkit_context.cc @@ -75,20 +75,6 @@ void WebKitContext::DeleteDataModifiedSince(const base::Time& cutoff) { dom_storage_context_->DeleteDataModifiedSince(cutoff); } -void WebKitContext::DeleteSessionStorageNamespace( - int64 session_storage_namespace_id) { - if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED) && - BrowserThread::PostTask( - BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, - base::Bind(&WebKitContext::DeleteSessionStorageNamespace, this, - session_storage_namespace_id))) { - return; - } - - dom_storage_context_->DeleteSessionStorageNamespace( - session_storage_namespace_id); -} - void WebKitContext::SaveSessionState() { if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)) { BrowserThread::PostTask( diff --git a/content/browser/in_process_webkit/webkit_context.h b/content/browser/in_process_webkit/webkit_context.h index fa4988e..747a6da 100644 --- a/content/browser/in_process_webkit/webkit_context.h +++ b/content/browser/in_process_webkit/webkit_context.h @@ -64,10 +64,6 @@ class CONTENT_EXPORT WebKitContext // last modified on or after the following time. void DeleteDataModifiedSince(const base::Time& cutoff); - // Delete the session storage namespace associated with this id. Can be - // called from any thread. - void DeleteSessionStorageNamespace(int64 session_storage_namespace_id); - // Tells all children to not do delete data when destructed. void SaveSessionState(); |