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

Side by Side Diff: Source/web/StorageQuotaClientImpl.cpp

Issue 676183002: Oilpan: simplify quota storage callbacks objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « Source/web/StorageQuotaClientImpl.h ('k') | public/platform/WebStorageQuotaCallbacks.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "modules/quota/StorageQuotaCallback.h" 43 #include "modules/quota/StorageQuotaCallback.h"
44 #include "modules/quota/StorageQuotaCallbacksImpl.h" 44 #include "modules/quota/StorageQuotaCallbacksImpl.h"
45 #include "modules/quota/StorageUsageCallback.h" 45 #include "modules/quota/StorageUsageCallback.h"
46 #include "public/platform/WebStorageQuotaType.h" 46 #include "public/platform/WebStorageQuotaType.h"
47 #include "public/web/WebFrameClient.h" 47 #include "public/web/WebFrameClient.h"
48 #include "web/WebLocalFrameImpl.h" 48 #include "web/WebLocalFrameImpl.h"
49 #include "wtf/Threading.h" 49 #include "wtf/Threading.h"
50 50
51 namespace blink { 51 namespace blink {
52 52
53 PassOwnPtrWillBeRawPtr<StorageQuotaClientImpl> StorageQuotaClientImpl::create() 53 StorageQuotaClientImpl::StorageQuotaClientImpl()
54 { 54 {
55 return adoptPtrWillBeNoop(new StorageQuotaClientImpl());
56 } 55 }
57 56
58 StorageQuotaClientImpl::~StorageQuotaClientImpl() 57 StorageQuotaClientImpl::~StorageQuotaClientImpl()
59 { 58 {
60 } 59 }
61 60
62 void StorageQuotaClientImpl::requestQuota(ExecutionContext* executionContext, We bStorageQuotaType storageType, unsigned long long newQuotaInBytes, StorageQuotaC allback* successCallback, StorageErrorCallback* errorCallback) 61 void StorageQuotaClientImpl::requestQuota(ExecutionContext* executionContext, We bStorageQuotaType storageType, unsigned long long newQuotaInBytes, StorageQuotaC allback* successCallback, StorageErrorCallback* errorCallback)
63 { 62 {
64 ASSERT(executionContext); 63 ASSERT(executionContext);
65 64
66 if (executionContext->isDocument()) { 65 if (executionContext->isDocument()) {
67 Document* document = toDocument(executionContext); 66 Document* document = toDocument(executionContext);
68 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->fra me()); 67 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->fra me());
69 OwnPtrWillBeRawPtr<StorageQuotaCallbacks> callbacks = DeprecatedStorageQ uotaCallbacksImpl::create(successCallback, errorCallback); 68 StorageQuotaCallbacks* callbacks = DeprecatedStorageQuotaCallbacksImpl:: create(successCallback, errorCallback);
70 webFrame->client()->requestStorageQuota(webFrame, storageType, newQuotaI nBytes, callbacks.release()); 69 webFrame->client()->requestStorageQuota(webFrame, storageType, newQuotaI nBytes, callbacks);
71 } else { 70 } else {
72 // Requesting quota in Worker is not supported. 71 // Requesting quota in Worker is not supported.
73 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er rorCallback, NotSupportedError)); 72 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er rorCallback, NotSupportedError));
74 } 73 }
75 } 74 }
76 75
77 ScriptPromise StorageQuotaClientImpl::requestPersistentQuota(ScriptState* script State, unsigned long long newQuotaInBytes) 76 ScriptPromise StorageQuotaClientImpl::requestPersistentQuota(ScriptState* script State, unsigned long long newQuotaInBytes)
78 { 77 {
79 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); 78 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState);
80 ScriptPromise promise = resolver->promise(); 79 ScriptPromise promise = resolver->promise();
81 80
82 if (scriptState->executionContext()->isDocument()) { 81 if (scriptState->executionContext()->isDocument()) {
83 Document* document = toDocument(scriptState->executionContext()); 82 Document* document = toDocument(scriptState->executionContext());
84 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->fra me()); 83 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->fra me());
85 OwnPtrWillBeRawPtr<StorageQuotaCallbacks> callbacks = StorageQuotaCallba cksImpl::create(resolver); 84 StorageQuotaCallbacks* callbacks = StorageQuotaCallbacksImpl::create(res olver);
86 webFrame->client()->requestStorageQuota(webFrame, WebStorageQuotaTypePer sistent, newQuotaInBytes, callbacks.release()); 85 webFrame->client()->requestStorageQuota(webFrame, WebStorageQuotaTypePer sistent, newQuotaInBytes, callbacks);
87 } else { 86 } else {
88 // Requesting quota in Worker is not supported. 87 // Requesting quota in Worker is not supported.
89 resolver->reject(DOMError::create(NotSupportedError)); 88 resolver->reject(DOMError::create(NotSupportedError));
90 } 89 }
91 90
92 return promise; 91 return promise;
93 } 92 }
94 93
95 StorageQuotaClientImpl::StorageQuotaClientImpl()
96 {
97 }
98
99 } // namespace blink 94 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/StorageQuotaClientImpl.h ('k') | public/platform/WebStorageQuotaCallbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698