OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/dom_storage/dom_storage_session.h" | 5 #include "webkit/dom_storage/dom_storage_session.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/tracked_objects.h" | 10 #include "base/tracked_objects.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 context->task_runner()->PostTask( | 33 context->task_runner()->PostTask( |
34 FROM_HERE, | 34 FROM_HERE, |
35 base::Bind(&DomStorageContext::CreateSessionNamespace, | 35 base::Bind(&DomStorageContext::CreateSessionNamespace, |
36 context_, namespace_id_, persistent_namespace_id_)); | 36 context_, namespace_id_, persistent_namespace_id_)); |
37 } | 37 } |
38 | 38 |
39 void DomStorageSession::SetShouldPersist(bool should_persist) { | 39 void DomStorageSession::SetShouldPersist(bool should_persist) { |
40 should_persist_ = should_persist; | 40 should_persist_ = should_persist; |
41 } | 41 } |
42 | 42 |
| 43 bool DomStorageSession::IsFromContext(DomStorageContext* context) { |
| 44 return context_.get() == context; |
| 45 } |
| 46 |
43 DomStorageSession* DomStorageSession::Clone() { | 47 DomStorageSession* DomStorageSession::Clone() { |
44 return CloneFrom(context_, namespace_id_); | 48 return CloneFrom(context_, namespace_id_); |
45 } | 49 } |
46 | 50 |
47 // static | 51 // static |
48 DomStorageSession* DomStorageSession::CloneFrom(DomStorageContext* context, | 52 DomStorageSession* DomStorageSession::CloneFrom(DomStorageContext* context, |
49 int64 namepace_id_to_clone) { | 53 int64 namepace_id_to_clone) { |
50 int64 clone_id = context->AllocateSessionId(); | 54 int64 clone_id = context->AllocateSessionId(); |
51 std::string persistent_clone_id = context->AllocatePersistentSessionId(); | 55 std::string persistent_clone_id = context->AllocatePersistentSessionId(); |
52 context->task_runner()->PostTask( | 56 context->task_runner()->PostTask( |
(...skipping 14 matching lines...) Expand all Loading... |
67 } | 71 } |
68 | 72 |
69 DomStorageSession::~DomStorageSession() { | 73 DomStorageSession::~DomStorageSession() { |
70 context_->task_runner()->PostTask( | 74 context_->task_runner()->PostTask( |
71 FROM_HERE, | 75 FROM_HERE, |
72 base::Bind(&DomStorageContext::DeleteSessionNamespace, | 76 base::Bind(&DomStorageContext::DeleteSessionNamespace, |
73 context_, namespace_id_, should_persist_)); | 77 context_, namespace_id_, should_persist_)); |
74 } | 78 } |
75 | 79 |
76 } // namespace dom_storage | 80 } // namespace dom_storage |
OLD | NEW |