| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "modules/quota/WorkerNavigatorStorageQuota.h" | 31 #include "modules/quota/WorkerNavigatorStorageQuota.h" |
| 32 | 32 |
| 33 #include "modules/quota/DeprecatedStorageQuota.h" | 33 #include "modules/quota/DeprecatedStorageQuota.h" |
| 34 #include "modules/quota/StorageManager.h" | 34 #include "modules/quota/StorageManager.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 WorkerNavigatorStorageQuota::WorkerNavigatorStorageQuota() {} | 38 WorkerNavigatorStorageQuota::WorkerNavigatorStorageQuota( |
| 39 WorkerNavigator& workerNavigator) |
| 40 : Supplement<WorkerNavigator>(workerNavigator) {} |
| 39 | 41 |
| 40 const char* WorkerNavigatorStorageQuota::supplementName() { | 42 const char* WorkerNavigatorStorageQuota::supplementName() { |
| 41 return "WorkerNavigatorStorageQuota"; | 43 return "WorkerNavigatorStorageQuota"; |
| 42 } | 44 } |
| 43 | 45 |
| 44 WorkerNavigatorStorageQuota& WorkerNavigatorStorageQuota::from( | 46 WorkerNavigatorStorageQuota& WorkerNavigatorStorageQuota::from( |
| 45 WorkerNavigator& navigator) { | 47 WorkerNavigator& navigator) { |
| 46 WorkerNavigatorStorageQuota* supplement = | 48 WorkerNavigatorStorageQuota* supplement = |
| 47 static_cast<WorkerNavigatorStorageQuota*>( | 49 static_cast<WorkerNavigatorStorageQuota*>( |
| 48 Supplement<WorkerNavigator>::from(navigator, supplementName())); | 50 Supplement<WorkerNavigator>::from(navigator, supplementName())); |
| 49 if (!supplement) { | 51 if (!supplement) { |
| 50 supplement = new WorkerNavigatorStorageQuota(); | 52 supplement = new WorkerNavigatorStorageQuota(navigator); |
| 51 provideTo(navigator, supplementName(), supplement); | 53 provideTo(navigator, supplementName(), supplement); |
| 52 } | 54 } |
| 53 return *supplement; | 55 return *supplement; |
| 54 } | 56 } |
| 55 | 57 |
| 56 StorageManager* WorkerNavigatorStorageQuota::storage( | 58 StorageManager* WorkerNavigatorStorageQuota::storage( |
| 57 WorkerNavigator& navigator) { | 59 WorkerNavigator& navigator) { |
| 58 return WorkerNavigatorStorageQuota::from(navigator).storage(); | 60 return WorkerNavigatorStorageQuota::from(navigator).storage(); |
| 59 } | 61 } |
| 60 | 62 |
| 61 StorageManager* WorkerNavigatorStorageQuota::storage() const { | 63 StorageManager* WorkerNavigatorStorageQuota::storage() const { |
| 62 if (!m_storageManager) | 64 if (!m_storageManager) |
| 63 m_storageManager = new StorageManager(); | 65 m_storageManager = new StorageManager(); |
| 64 return m_storageManager.get(); | 66 return m_storageManager.get(); |
| 65 } | 67 } |
| 66 | 68 |
| 67 DEFINE_TRACE(WorkerNavigatorStorageQuota) { | 69 DEFINE_TRACE(WorkerNavigatorStorageQuota) { |
| 68 visitor->trace(m_storageManager); | 70 visitor->trace(m_storageManager); |
| 69 Supplement<WorkerNavigator>::trace(visitor); | 71 Supplement<WorkerNavigator>::trace(visitor); |
| 70 } | 72 } |
| 71 | 73 |
| 72 } // namespace blink | 74 } // namespace blink |
| OLD | NEW |