| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2009 Google Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "modules/storage/StorageNamespace.h" | 26 #include "modules/storage/StorageNamespace.h" |
| 27 | 27 |
| 28 #include "modules/storage/StorageArea.h" | 28 #include "modules/storage/StorageArea.h" |
| 29 #include "platform/weborigin/SecurityOrigin.h" | 29 #include "platform/weborigin/SecurityOrigin.h" |
| 30 #include "public/platform/Platform.h" | 30 #include "public/platform/Platform.h" |
| 31 #include "public/platform/WebStorageArea.h" | 31 #include "public/platform/WebStorageArea.h" |
| 32 #include "public/platform/WebStorageNamespace.h" | 32 #include "public/platform/WebStorageNamespace.h" |
| 33 #include "wtf/PtrUtil.h" | |
| 34 #include <memory> | |
| 35 | 33 |
| 36 namespace blink { | 34 namespace blink { |
| 37 | 35 |
| 38 StorageNamespace::StorageNamespace(std::unique_ptr<WebStorageNamespace> webStora
geNamespace) | 36 StorageNamespace::StorageNamespace(PassOwnPtr<WebStorageNamespace> webStorageNam
espace) |
| 39 : m_webStorageNamespace(std::move(webStorageNamespace)) | 37 : m_webStorageNamespace(std::move(webStorageNamespace)) |
| 40 { | 38 { |
| 41 } | 39 } |
| 42 | 40 |
| 43 StorageNamespace::~StorageNamespace() | 41 StorageNamespace::~StorageNamespace() |
| 44 { | 42 { |
| 45 } | 43 } |
| 46 | 44 |
| 47 StorageArea* StorageNamespace::localStorageArea(SecurityOrigin* origin) | 45 StorageArea* StorageNamespace::localStorageArea(SecurityOrigin* origin) |
| 48 { | 46 { |
| 49 ASSERT(isMainThread()); | 47 ASSERT(isMainThread()); |
| 50 static WebStorageNamespace* localStorageNamespace = nullptr; | 48 static WebStorageNamespace* localStorageNamespace = nullptr; |
| 51 if (!localStorageNamespace) | 49 if (!localStorageNamespace) |
| 52 localStorageNamespace = Platform::current()->createLocalStorageNamespace
(); | 50 localStorageNamespace = Platform::current()->createLocalStorageNamespace
(); |
| 53 return StorageArea::create(wrapUnique(localStorageNamespace->createStorageAr
ea(origin->toString())), LocalStorage); | 51 return StorageArea::create(adoptPtr(localStorageNamespace->createStorageArea
(origin->toString())), LocalStorage); |
| 54 } | 52 } |
| 55 | 53 |
| 56 StorageArea* StorageNamespace::storageArea(SecurityOrigin* origin) | 54 StorageArea* StorageNamespace::storageArea(SecurityOrigin* origin) |
| 57 { | 55 { |
| 58 return StorageArea::create(wrapUnique(m_webStorageNamespace->createStorageAr
ea(origin->toString())), SessionStorage); | 56 return StorageArea::create(adoptPtr(m_webStorageNamespace->createStorageArea
(origin->toString())), SessionStorage); |
| 59 } | 57 } |
| 60 | 58 |
| 61 bool StorageNamespace::isSameNamespace(const WebStorageNamespace& sessionNamespa
ce) const | 59 bool StorageNamespace::isSameNamespace(const WebStorageNamespace& sessionNamespa
ce) const |
| 62 { | 60 { |
| 63 return m_webStorageNamespace && m_webStorageNamespace->isSameNamespace(sessi
onNamespace); | 61 return m_webStorageNamespace && m_webStorageNamespace->isSameNamespace(sessi
onNamespace); |
| 64 } | 62 } |
| 65 | 63 |
| 66 } // namespace blink | 64 } // namespace blink |
| OLD | NEW |