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

Side by Side Diff: third_party/WebKit/Source/modules/budget/BudgetService.cpp

Issue 2522553003: Mojo C++ bindings: switch WebKit mojom targets to use STL/WTF types. (Closed)
Patch Set: . Created 4 years 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/budget/BudgetService.h" 5 #include "modules/budget/BudgetService.h"
6 6
7 #include "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 m_service->GetBudget( 102 m_service->GetBudget(
103 origin, convertToBaseCallback(WTF::bind(&BudgetService::gotBudget, 103 origin, convertToBaseCallback(WTF::bind(&BudgetService::gotBudget,
104 wrapPersistent(this), 104 wrapPersistent(this),
105 wrapPersistent(resolver)))); 105 wrapPersistent(resolver))));
106 return promise; 106 return promise;
107 } 107 }
108 108
109 void BudgetService::gotBudget( 109 void BudgetService::gotBudget(
110 ScriptPromiseResolver* resolver, 110 ScriptPromiseResolver* resolver,
111 mojom::blink::BudgetServiceErrorType error, 111 mojom::blink::BudgetServiceErrorType error,
112 const mojo::WTFArray<mojom::blink::BudgetStatePtr> expectations) const { 112 const WTF::Vector<mojom::blink::BudgetStatePtr> expectations) const {
113 if (error != mojom::blink::BudgetServiceErrorType::NONE) { 113 if (error != mojom::blink::BudgetServiceErrorType::NONE) {
114 resolver->reject(errorTypeToException(error)); 114 resolver->reject(errorTypeToException(error));
115 return; 115 return;
116 } 116 }
117 117
118 // Copy the chunks into the budget array. 118 // Copy the chunks into the budget array.
119 HeapVector<Member<BudgetState>> budget(expectations.size()); 119 HeapVector<Member<BudgetState>> budget(expectations.size());
120 for (size_t i = 0; i < expectations.size(); i++) 120 for (size_t i = 0; i < expectations.size(); i++)
121 budget[i] = 121 budget[i] =
122 new BudgetState(expectations[i]->budget_at, expectations[i]->time); 122 new BudgetState(expectations[i]->budget_at, expectations[i]->time);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 resolver->resolve(success); 163 resolver->resolve(success);
164 } 164 }
165 165
166 void BudgetService::onConnectionError() { 166 void BudgetService::onConnectionError() {
167 LOG(ERROR) << "Unable to connect to the Mojo BudgetService."; 167 LOG(ERROR) << "Unable to connect to the Mojo BudgetService.";
168 // TODO(harkness): Reject in flight promises. 168 // TODO(harkness): Reject in flight promises.
169 } 169 }
170 170
171 } // namespace blink 171 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/budget/BudgetService.h ('k') | third_party/WebKit/public/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698