Chromium Code Reviews| Index: third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp |
| diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp |
| index cde18aa442c6f5acfbd266effe8dcd000d86d289..eb175aa3d5640ef0434c393e2e01f676e4f1e156 100644 |
| --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp |
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp |
| @@ -33,15 +33,24 @@ WebBluetooth* BluetoothSupplement::from(LocalFrame* frame) |
| return nullptr; |
| } |
| -WebBluetooth* BluetoothSupplement::getFromScriptState(ScriptState* scriptState) |
| +static WebBluetooth* getFromLocalDOMWindow(LocalDOMWindow* window) |
| { |
| - LocalDOMWindow* window = scriptState->domWindow(); |
| if (window && window->frame()) { |
|
haraken
2015/10/10 14:19:35
As commented in the other CL, it is unsafe to use
ortuno
2015/10/12 17:46:07
Using executionContext now.
|
| return BluetoothSupplement::from(window->frame()); |
| } |
| return nullptr; |
| } |
| +WebBluetooth* BluetoothSupplement::getFromScriptState(ScriptState* scriptState) |
| +{ |
| + return getFromLocalDOMWindow(scriptState->domWindow()); |
| +} |
| + |
| +WebBluetooth* BluetoothSupplement::getFromExecutionContext(ExecutionContext* executionContext) |
| +{ |
| + return getFromLocalDOMWindow(executionContext->executingWindow()); |
|
haraken
2015/10/10 14:19:35
executionContext->executingWindow() may work but i
ortuno
2015/10/12 17:46:07
Done.
|
| +} |
| + |
| DEFINE_TRACE(BluetoothSupplement) |
| { |
| WillBeHeapSupplement<LocalFrame>::trace(visitor); |