| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/in_process_webkit/storage_namespace.h" | 5 #include "chrome/browser/in_process_webkit/storage_namespace.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "chrome/browser/in_process_webkit/dom_storage_context.h" | 8 #include "chrome/browser/in_process_webkit/dom_storage_context.h" |
| 9 #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" | 9 #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" |
| 10 #include "chrome/browser/in_process_webkit/storage_area.h" | 10 #include "chrome/browser/in_process_webkit/storage_area.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 int64 id = dom_storage_context->AllocateStorageNamespaceId(); | 35 int64 id = dom_storage_context->AllocateStorageNamespaceId(); |
| 36 DCHECK(!dom_storage_context->GetStorageNamespace(id)); | 36 DCHECK(!dom_storage_context->GetStorageNamespace(id)); |
| 37 WebStorageNamespace* web_storage_namespace = | 37 WebStorageNamespace* web_storage_namespace = |
| 38 WebStorageNamespace::createSessionStorageNamespace(); | 38 WebStorageNamespace::createSessionStorageNamespace(); |
| 39 return new StorageNamespace(dom_storage_context, web_storage_namespace, id, | 39 return new StorageNamespace(dom_storage_context, web_storage_namespace, id, |
| 40 DOM_STORAGE_SESSION); | 40 DOM_STORAGE_SESSION); |
| 41 } | 41 } |
| 42 | 42 |
| 43 StorageNamespace::StorageNamespace(DOMStorageContext* dom_storage_context, | 43 StorageNamespace::StorageNamespace(DOMStorageContext* dom_storage_context, |
| 44 WebStorageNamespace* storage_namespace, | 44 WebStorageNamespace* storage_namespace, |
| 45 int64 id, DOMStorageType storage_type) | 45 int64 id, DOMStorageType dom_storage_type) |
| 46 : dom_storage_context_(dom_storage_context), | 46 : dom_storage_context_(dom_storage_context), |
| 47 storage_namespace_(storage_namespace), | 47 storage_namespace_(storage_namespace), |
| 48 id_(id), | 48 id_(id), |
| 49 storage_type_(storage_type) { | 49 dom_storage_type_(dom_storage_type) { |
| 50 DCHECK(dom_storage_context_); | 50 DCHECK(dom_storage_context_); |
| 51 DCHECK(storage_namespace_); | 51 DCHECK(storage_namespace_); |
| 52 dom_storage_context_->RegisterStorageNamespace(this); | 52 dom_storage_context_->RegisterStorageNamespace(this); |
| 53 } | 53 } |
| 54 | 54 |
| 55 StorageNamespace::~StorageNamespace() { | 55 StorageNamespace::~StorageNamespace() { |
| 56 dom_storage_context_->UnregisterStorageNamespace(this); | 56 dom_storage_context_->UnregisterStorageNamespace(this); |
| 57 | 57 |
| 58 OriginToStorageAreaMap::iterator iter = origin_to_storage_area_.begin(); | 58 OriginToStorageAreaMap::iterator iter = origin_to_storage_area_.begin(); |
| 59 OriginToStorageAreaMap::iterator end = origin_to_storage_area_.end(); | 59 OriginToStorageAreaMap::iterator end = origin_to_storage_area_.end(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 75 DCHECK(!dom_storage_context_->GetStorageArea(id)); | 75 DCHECK(!dom_storage_context_->GetStorageArea(id)); |
| 76 WebStorageArea* web_storage_area = | 76 WebStorageArea* web_storage_area = |
| 77 storage_namespace_->createStorageArea(origin); | 77 storage_namespace_->createStorageArea(origin); |
| 78 StorageArea* storage_area = new StorageArea(origin, web_storage_area, id); | 78 StorageArea* storage_area = new StorageArea(origin, web_storage_area, id); |
| 79 origin_to_storage_area_[origin] = storage_area; | 79 origin_to_storage_area_[origin] = storage_area; |
| 80 dom_storage_context_->RegisterStorageArea(storage_area); | 80 dom_storage_context_->RegisterStorageArea(storage_area); |
| 81 return storage_area; | 81 return storage_area; |
| 82 } | 82 } |
| 83 | 83 |
| 84 StorageNamespace* StorageNamespace::Copy() { | 84 StorageNamespace* StorageNamespace::Copy() { |
| 85 DCHECK(storage_type_ == DOM_STORAGE_SESSION); | 85 DCHECK(dom_storage_type_ == DOM_STORAGE_SESSION); |
| 86 int64 id = dom_storage_context_->AllocateStorageNamespaceId(); | 86 int64 id = dom_storage_context_->AllocateStorageNamespaceId(); |
| 87 DCHECK(!dom_storage_context_->GetStorageNamespace(id)); | 87 DCHECK(!dom_storage_context_->GetStorageNamespace(id)); |
| 88 WebStorageNamespace* new_storage_namespace = storage_namespace_->copy(); | 88 WebStorageNamespace* new_storage_namespace = storage_namespace_->copy(); |
| 89 return new StorageNamespace(dom_storage_context_, new_storage_namespace, id, | 89 return new StorageNamespace(dom_storage_context_, new_storage_namespace, id, |
| 90 storage_type_); | 90 dom_storage_type_); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void StorageNamespace::Close() { | 93 void StorageNamespace::Close() { |
| 94 storage_namespace_->close(); | 94 storage_namespace_->close(); |
| 95 } | 95 } |
| OLD | NEW |