| 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_namespace.h" | 5 #include "webkit/dom_storage/dom_storage_namespace.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "webkit/dom_storage/dom_storage_area.h" | 9 #include "webkit/dom_storage/dom_storage_area.h" |
| 10 #include "webkit/dom_storage/dom_storage_task_runner.h" | 10 #include "webkit/dom_storage/dom_storage_task_runner.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 DomStorageNamespace* clone = | 57 DomStorageNamespace* clone = |
| 58 new DomStorageNamespace(clone_namespace_id, task_runner_); | 58 new DomStorageNamespace(clone_namespace_id, task_runner_); |
| 59 AreaMap::const_iterator it = areas_.begin(); | 59 AreaMap::const_iterator it = areas_.begin(); |
| 60 for (; it != areas_.end(); ++it) { | 60 for (; it != areas_.end(); ++it) { |
| 61 DomStorageArea* area = it->second.area_->ShallowCopy(clone_namespace_id); | 61 DomStorageArea* area = it->second.area_->ShallowCopy(clone_namespace_id); |
| 62 clone->areas_[it->first] = AreaHolder(area, 0); | 62 clone->areas_[it->first] = AreaHolder(area, 0); |
| 63 } | 63 } |
| 64 return clone; | 64 return clone; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void DomStorageNamespace::PurgeMemory() { |
| 68 // TODO(michaeln): write me |
| 69 } |
| 70 |
| 71 void DomStorageNamespace::Shutdown() { |
| 72 AreaMap::const_iterator it = areas_.begin(); |
| 73 for (; it != areas_.end(); ++it) |
| 74 it->second.area_->Shutdown(); |
| 75 } |
| 76 |
| 77 |
| 67 DomStorageNamespace::AreaHolder* | 78 DomStorageNamespace::AreaHolder* |
| 68 DomStorageNamespace::GetAreaHolder(const GURL& origin) { | 79 DomStorageNamespace::GetAreaHolder(const GURL& origin) { |
| 69 AreaMap::iterator found = areas_.find(origin); | 80 AreaMap::iterator found = areas_.find(origin); |
| 70 if (found == areas_.end()) | 81 if (found == areas_.end()) |
| 71 return NULL; | 82 return NULL; |
| 72 return &(found->second); | 83 return &(found->second); |
| 73 } | 84 } |
| 74 | 85 |
| 75 // AreaHolder | 86 // AreaHolder |
| 76 | 87 |
| 77 DomStorageNamespace::AreaHolder::AreaHolder() | 88 DomStorageNamespace::AreaHolder::AreaHolder() |
| 78 : open_count_(0) { | 89 : open_count_(0) { |
| 79 } | 90 } |
| 80 | 91 |
| 81 DomStorageNamespace::AreaHolder::AreaHolder( | 92 DomStorageNamespace::AreaHolder::AreaHolder( |
| 82 DomStorageArea* area, int count) | 93 DomStorageArea* area, int count) |
| 83 : area_(area), open_count_(count) { | 94 : area_(area), open_count_(count) { |
| 84 } | 95 } |
| 85 | 96 |
| 86 DomStorageNamespace::AreaHolder::~AreaHolder() { | 97 DomStorageNamespace::AreaHolder::~AreaHolder() { |
| 87 } | 98 } |
| 88 | 99 |
| 89 } // namespace dom_storage | 100 } // namespace dom_storage |
| OLD | NEW |