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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 DomStorageSession* DomStorageSession::Clone() { | 25 DomStorageSession* DomStorageSession::Clone() { |
26 int64 clone_id = context_->AllocateSessionId(); | 26 int64 clone_id = context_->AllocateSessionId(); |
27 context_->task_runner()->PostTask( | 27 context_->task_runner()->PostTask( |
28 FROM_HERE, | 28 FROM_HERE, |
29 base::Bind(&DomStorageContext::CloneSessionNamespace, | 29 base::Bind(&DomStorageContext::CloneSessionNamespace, |
30 context_, namespace_id_, clone_id)); | 30 context_, namespace_id_, clone_id)); |
31 return new DomStorageSession(context_, clone_id); | 31 return new DomStorageSession(context_, clone_id); |
32 } | 32 } |
33 | 33 |
| 34 void DomStorageSession::AddSessionStorageObserver( |
| 35 int64 namespace_id, |
| 36 DomStorageContext::SessionStorageObserver* observer) { |
| 37 context_->task_runner()->PostTask( |
| 38 FROM_HERE, |
| 39 base::Bind(&DomStorageContext::AddSessionStorageObserver, |
| 40 context_, namespace_id_, observer)); |
| 41 } |
| 42 |
| 43 void DomStorageSession::RemoveSessionStorageObserver(int64 namespace_id) { |
| 44 context_->task_runner()->PostTask( |
| 45 FROM_HERE, |
| 46 base::Bind(&DomStorageContext::RemoveSessionStorageObserver, |
| 47 context_, namespace_id_)); |
| 48 } |
| 49 |
34 DomStorageSession::DomStorageSession(DomStorageContext* context, | 50 DomStorageSession::DomStorageSession(DomStorageContext* context, |
35 int64 namespace_id) | 51 int64 namespace_id) |
36 : context_(context), | 52 : context_(context), |
37 namespace_id_(namespace_id) { | 53 namespace_id_(namespace_id) { |
38 // This ctor is intended for use by the Clone() method. | 54 // This ctor is intended for use by the Clone() method. |
39 } | 55 } |
40 | 56 |
41 DomStorageSession::~DomStorageSession() { | 57 DomStorageSession::~DomStorageSession() { |
42 context_->task_runner()->PostTask( | 58 context_->task_runner()->PostTask( |
43 FROM_HERE, | 59 FROM_HERE, |
44 base::Bind(&DomStorageContext::DeleteSessionNamespace, | 60 base::Bind(&DomStorageContext::DeleteSessionNamespace, |
45 context_, namespace_id_)); | 61 context_, namespace_id_)); |
46 } | 62 } |
47 | 63 |
48 } // namespace dom_storage | 64 } // namespace dom_storage |
OLD | NEW |