Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: third_party/WebKit/Source/modules/quota/WorkerNavigatorStorageQuota.cpp

Issue 2655463002: Revert of Use a new Supplement constructor in Navigator supplements (part 2) (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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) {}
41 39
42 const char* WorkerNavigatorStorageQuota::supplementName() { 40 const char* WorkerNavigatorStorageQuota::supplementName() {
43 return "WorkerNavigatorStorageQuota"; 41 return "WorkerNavigatorStorageQuota";
44 } 42 }
45 43
46 WorkerNavigatorStorageQuota& WorkerNavigatorStorageQuota::from( 44 WorkerNavigatorStorageQuota& WorkerNavigatorStorageQuota::from(
47 WorkerNavigator& navigator) { 45 WorkerNavigator& navigator) {
48 WorkerNavigatorStorageQuota* supplement = 46 WorkerNavigatorStorageQuota* supplement =
49 static_cast<WorkerNavigatorStorageQuota*>( 47 static_cast<WorkerNavigatorStorageQuota*>(
50 Supplement<WorkerNavigator>::from(navigator, supplementName())); 48 Supplement<WorkerNavigator>::from(navigator, supplementName()));
51 if (!supplement) { 49 if (!supplement) {
52 supplement = new WorkerNavigatorStorageQuota(navigator); 50 supplement = new WorkerNavigatorStorageQuota();
53 provideTo(navigator, supplementName(), supplement); 51 provideTo(navigator, supplementName(), supplement);
54 } 52 }
55 return *supplement; 53 return *supplement;
56 } 54 }
57 55
58 StorageManager* WorkerNavigatorStorageQuota::storage( 56 StorageManager* WorkerNavigatorStorageQuota::storage(
59 WorkerNavigator& navigator) { 57 WorkerNavigator& navigator) {
60 return WorkerNavigatorStorageQuota::from(navigator).storage(); 58 return WorkerNavigatorStorageQuota::from(navigator).storage();
61 } 59 }
62 60
63 StorageManager* WorkerNavigatorStorageQuota::storage() const { 61 StorageManager* WorkerNavigatorStorageQuota::storage() const {
64 if (!m_storageManager) 62 if (!m_storageManager)
65 m_storageManager = new StorageManager(); 63 m_storageManager = new StorageManager();
66 return m_storageManager.get(); 64 return m_storageManager.get();
67 } 65 }
68 66
69 DEFINE_TRACE(WorkerNavigatorStorageQuota) { 67 DEFINE_TRACE(WorkerNavigatorStorageQuota) {
70 visitor->trace(m_storageManager); 68 visitor->trace(m_storageManager);
71 Supplement<WorkerNavigator>::trace(visitor); 69 Supplement<WorkerNavigator>::trace(visitor);
72 } 70 }
73 71
74 } // namespace blink 72 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698