| OLD | NEW |
| 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 26 matching lines...) Expand all Loading... |
| 37 "Requested opration was not supported"); | 37 "Requested opration was not supported"); |
| 38 } | 38 } |
| 39 NOTREACHED(); | 39 NOTREACHED(); |
| 40 return nullptr; | 40 return nullptr; |
| 41 } | 41 } |
| 42 | 42 |
| 43 } // namespace | 43 } // namespace |
| 44 | 44 |
| 45 BudgetService::BudgetService() { | 45 BudgetService::BudgetService() { |
| 46 Platform::current()->interfaceProvider()->getInterface( | 46 Platform::current()->interfaceProvider()->getInterface( |
| 47 mojo::GetProxy(&m_service)); | 47 mojo::MakeRequest(&m_service)); |
| 48 | 48 |
| 49 // Set a connection error handler, so that if an embedder doesn't | 49 // Set a connection error handler, so that if an embedder doesn't |
| 50 // implement a BudgetSerice mojo service, the developer will get a | 50 // implement a BudgetSerice mojo service, the developer will get a |
| 51 // actionable information. | 51 // actionable information. |
| 52 m_service.set_connection_error_handler(convertToBaseCallback( | 52 m_service.set_connection_error_handler(convertToBaseCallback( |
| 53 WTF::bind(&BudgetService::onConnectionError, wrapWeakPersistent(this)))); | 53 WTF::bind(&BudgetService::onConnectionError, wrapWeakPersistent(this)))); |
| 54 } | 54 } |
| 55 | 55 |
| 56 BudgetService::~BudgetService() {} | 56 BudgetService::~BudgetService() {} |
| 57 | 57 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 resolver->resolve(success); | 157 resolver->resolve(success); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void BudgetService::onConnectionError() { | 160 void BudgetService::onConnectionError() { |
| 161 LOG(ERROR) << "Unable to connect to the Mojo BudgetService."; | 161 LOG(ERROR) << "Unable to connect to the Mojo BudgetService."; |
| 162 // TODO(harkness): Reject in flight promises. | 162 // TODO(harkness): Reject in flight promises. |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace blink | 165 } // namespace blink |
| OLD | NEW |