| 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> |
| 33 | 35 |
| 34 namespace blink { | 36 namespace blink { |
| 35 | 37 |
| 36 StorageNamespace::StorageNamespace(PassOwnPtr<WebStorageNamespace> webStorageNam
espace) | 38 StorageNamespace::StorageNamespace(std::unique_ptr<WebStorageNamespace> webStora
geNamespace) |
| 37 : m_webStorageNamespace(std::move(webStorageNamespace)) | 39 : m_webStorageNamespace(std::move(webStorageNamespace)) |
| 38 { | 40 { |
| 39 } | 41 } |
| 40 | 42 |
| 41 StorageNamespace::~StorageNamespace() | 43 StorageNamespace::~StorageNamespace() |
| 42 { | 44 { |
| 43 } | 45 } |
| 44 | 46 |
| 45 StorageArea* StorageNamespace::localStorageArea(SecurityOrigin* origin) | 47 StorageArea* StorageNamespace::localStorageArea(SecurityOrigin* origin) |
| 46 { | 48 { |
| 47 ASSERT(isMainThread()); | 49 ASSERT(isMainThread()); |
| 48 static WebStorageNamespace* localStorageNamespace = nullptr; | 50 static WebStorageNamespace* localStorageNamespace = nullptr; |
| 49 if (!localStorageNamespace) | 51 if (!localStorageNamespace) |
| 50 localStorageNamespace = Platform::current()->createLocalStorageNamespace
(); | 52 localStorageNamespace = Platform::current()->createLocalStorageNamespace
(); |
| 51 return StorageArea::create(adoptPtr(localStorageNamespace->createStorageArea
(origin->toString())), LocalStorage); | 53 return StorageArea::create(wrapUnique(localStorageNamespace->createStorageAr
ea(origin->toString())), LocalStorage); |
| 52 } | 54 } |
| 53 | 55 |
| 54 StorageArea* StorageNamespace::storageArea(SecurityOrigin* origin) | 56 StorageArea* StorageNamespace::storageArea(SecurityOrigin* origin) |
| 55 { | 57 { |
| 56 return StorageArea::create(adoptPtr(m_webStorageNamespace->createStorageArea
(origin->toString())), SessionStorage); | 58 return StorageArea::create(wrapUnique(m_webStorageNamespace->createStorageAr
ea(origin->toString())), SessionStorage); |
| 57 } | 59 } |
| 58 | 60 |
| 59 bool StorageNamespace::isSameNamespace(const WebStorageNamespace& sessionNamespa
ce) const | 61 bool StorageNamespace::isSameNamespace(const WebStorageNamespace& sessionNamespa
ce) const |
| 60 { | 62 { |
| 61 return m_webStorageNamespace && m_webStorageNamespace->isSameNamespace(sessi
onNamespace); | 63 return m_webStorageNamespace && m_webStorageNamespace->isSameNamespace(sessi
onNamespace); |
| 62 } | 64 } |
| 63 | 65 |
| 64 } // namespace blink | 66 } // namespace blink |
| OLD | NEW |