Chromium Code Reviews| Index: Source/modules/bluetooth/BluetoothError.cpp |
| diff --git a/Source/modules/bluetooth/BluetoothError.cpp b/Source/modules/bluetooth/BluetoothError.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b77e3eda99f63ca52ab4d17bccbcef626cf35083 |
| --- /dev/null |
| +++ b/Source/modules/bluetooth/BluetoothError.cpp |
| @@ -0,0 +1,32 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "config.h" |
| +#include "modules/bluetooth/BluetoothError.h" |
| + |
| +#include "core/dom/ExceptionCode.h" |
| +#include "public/platform/WebBluetoothError.h" |
| +#include "wtf/OwnPtr.h" |
| + |
| +namespace blink { |
| + |
| +PassRefPtrWillBeRawPtr<DOMException> BluetoothError::take(ScriptPromiseResolver*, WebBluetoothError* webErrorRawPointer) |
| +{ |
| + OwnPtr<WebBluetoothError> webError = adoptPtr(webErrorRawPointer); |
| + switch (webError->errorType) { |
| + case WebBluetoothError::SecurityError: |
| + return DOMException::create(SecurityError, webError->message); |
| + case WebBluetoothError::NotFoundError: |
| + return DOMException::create(NotFoundError, webError->message); |
| + } |
| + ASSERT_NOT_REACHED(); |
| + return DOMException::create(UnknownError); |
| +} |
| + |
| +void BluetoothError::dispose(WebBluetoothError* webErrorRaw) |
| +{ |
| + delete webErrorRaw; |
|
haraken
2014/10/18 11:25:56
Why do we need to manually call 'delete'?
scheib
2014/10/19 03:54:21
This is an object for use by CallbackPromiseAdapte
|
| +} |
| + |
| +} // namespace blink |