OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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. | |
4 | |
5 #include "content/browser/in_process_webkit/session_storage_namespace_impl.h" | |
6 | |
7 #ifdef ENABLE_NEW_DOM_STORAGE_BACKEND | |
8 // This class is replaced by a new implementation in | |
9 // content/browser/dom_storage/session_storage_namespace_impl_new.h | |
10 #else | |
11 | |
12 #include "base/bind.h" | |
13 #include "base/logging.h" | |
14 #include "content/browser/in_process_webkit/dom_storage_context_impl.h" | |
15 #include "content/public/browser/browser_thread.h" | |
16 | |
17 using content::BrowserThread; | |
18 | |
19 SessionStorageNamespaceImpl::SessionStorageNamespaceImpl( | |
20 DOMStorageContextImpl* context) | |
21 : dom_storage_context_(context), | |
22 id_(dom_storage_context_->AllocateSessionStorageNamespaceId()) { | |
23 } | |
24 | |
25 SessionStorageNamespaceImpl::SessionStorageNamespaceImpl( | |
26 DOMStorageContextImpl* context, int64 id) | |
27 : dom_storage_context_(context), | |
28 id_(id) { | |
29 DCHECK(dom_storage_context_); | |
30 } | |
31 | |
32 SessionStorageNamespaceImpl::~SessionStorageNamespaceImpl() { | |
33 if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED) && | |
34 BrowserThread::PostTask( | |
35 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, | |
36 base::Bind(&DOMStorageContextImpl::DeleteSessionStorageNamespace, | |
37 dom_storage_context_, id_))) { | |
38 return; | |
39 } | |
40 | |
41 dom_storage_context_->DeleteSessionStorageNamespace(id_); | |
42 } | |
43 | |
44 SessionStorageNamespaceImpl* SessionStorageNamespaceImpl::Clone() { | |
45 return new SessionStorageNamespaceImpl( | |
46 dom_storage_context_, dom_storage_context_->CloneSessionStorage(id_)); | |
47 } | |
48 | |
49 #endif // ENABLE_NEW_DOM_STORAGE_BACKEND | |
50 | |
OLD | NEW |