| 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 26 matching lines...) Expand all Loading... |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 StorageNamespace::StorageNamespace( | 39 StorageNamespace::StorageNamespace( |
| 40 std::unique_ptr<WebStorageNamespace> web_storage_namespace) | 40 std::unique_ptr<WebStorageNamespace> web_storage_namespace) |
| 41 : web_storage_namespace_(std::move(web_storage_namespace)) {} | 41 : web_storage_namespace_(std::move(web_storage_namespace)) {} |
| 42 | 42 |
| 43 StorageNamespace::~StorageNamespace() {} | 43 StorageNamespace::~StorageNamespace() {} |
| 44 | 44 |
| 45 StorageArea* StorageNamespace::LocalStorageArea(SecurityOrigin* origin) { | 45 StorageArea* StorageNamespace::LocalStorageArea(SecurityOrigin* origin) { |
| 46 DCHECK(IsMainThread()); | 46 DCHECK(IsMainThread()); |
| 47 static WebStorageNamespace* local_storage_namespace = nullptr; | 47 static std::unique_ptr<WebStorageNamespace> local_storage_namespace = nullptr; |
| 48 if (!local_storage_namespace) | 48 if (!local_storage_namespace) |
| 49 local_storage_namespace = | 49 local_storage_namespace = |
| 50 Platform::Current()->CreateLocalStorageNamespace(); | 50 Platform::Current()->CreateLocalStorageNamespace(); |
| 51 return StorageArea::Create( | 51 return StorageArea::Create( |
| 52 WTF::WrapUnique(local_storage_namespace->CreateStorageArea( | 52 WTF::WrapUnique(local_storage_namespace->CreateStorageArea( |
| 53 WebSecurityOrigin(origin))), | 53 WebSecurityOrigin(origin))), |
| 54 kLocalStorage); | 54 kLocalStorage); |
| 55 } | 55 } |
| 56 | 56 |
| 57 StorageArea* StorageNamespace::GetStorageArea(SecurityOrigin* origin) { | 57 StorageArea* StorageNamespace::GetStorageArea(SecurityOrigin* origin) { |
| 58 return StorageArea::Create( | 58 return StorageArea::Create( |
| 59 WTF::WrapUnique( | 59 WTF::WrapUnique( |
| 60 web_storage_namespace_->CreateStorageArea(WebSecurityOrigin(origin))), | 60 web_storage_namespace_->CreateStorageArea(WebSecurityOrigin(origin))), |
| 61 kSessionStorage); | 61 kSessionStorage); |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool StorageNamespace::IsSameNamespace( | 64 bool StorageNamespace::IsSameNamespace( |
| 65 const WebStorageNamespace& session_namespace) const { | 65 const WebStorageNamespace& session_namespace) const { |
| 66 return web_storage_namespace_ && | 66 return web_storage_namespace_ && |
| 67 web_storage_namespace_->IsSameNamespace(session_namespace); | 67 web_storage_namespace_->IsSameNamespace(session_namespace); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace blink | 70 } // namespace blink |
| OLD | NEW |