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

Unified Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp

Issue 1399623003: bluetooth: Change BluetoothSupplement::from(ScriptState*) to from(LocalFrame*) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Moar cleanup Created 5 years, 2 months 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 side-by-side diff with in-line comments
Download patch
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 4f445c117e729c9d62f51ff6398c3ae43c6d3b5d..cde18aa442c6f5acfbd266effe8dcd000d86d289 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp
@@ -6,7 +6,6 @@
#include "modules/bluetooth/BluetoothSupplement.h"
#include "core/frame/LocalDOMWindow.h"
-#include "public/platform/Platform.h"
namespace blink {
@@ -26,15 +25,21 @@ void BluetoothSupplement::provideTo(LocalFrame& frame, WebBluetooth* bluetooth)
WillBeHeapSupplement<LocalFrame>::provideTo(frame, supplementName(), bluetoothSupplement.release());
};
-WebBluetooth* BluetoothSupplement::from(ScriptState* scriptState)
+WebBluetooth* BluetoothSupplement::from(LocalFrame* frame)
+{
+ BluetoothSupplement* supplement = static_cast<BluetoothSupplement*>(WillBeHeapSupplement<LocalFrame>::from(frame, supplementName()));
+ if (supplement && supplement->m_bluetooth)
haraken 2015/10/10 14:09:57 If the supplement is 0, don't you need to create a
ortuno 2015/10/12 17:33:52 We provide the Supplement to the frame here: http
+ return supplement->m_bluetooth;
+ return nullptr;
+}
+
+WebBluetooth* BluetoothSupplement::getFromScriptState(ScriptState* scriptState)
haraken 2015/10/10 14:09:57 getFromScriptState => fromScriptState (Blink doesn
ortuno 2015/10/12 17:33:52 Done.
{
LocalDOMWindow* window = scriptState->domWindow();
if (window && window->frame()) {
haraken 2015/10/10 14:09:57 It is unsafe to use window->frame() directly. You
ortuno 2015/10/12 17:33:52 As suggested in the other CL I changed it to get t
Jeffrey Yasskin 2015/10/12 21:57:24 Thanks Kentaro for catching my mistakes in writing
haraken 2015/10/12 23:29:25 Sorry for not having a comment about it. We had to
- BluetoothSupplement* supplement = static_cast<BluetoothSupplement*>(WillBeHeapSupplement<LocalFrame>::from(window->frame(), supplementName()));
- if (supplement && supplement->m_bluetooth)
- return supplement->m_bluetooth;
+ return BluetoothSupplement::from(window->frame());
}
- return Platform::current()->bluetooth();
+ return nullptr;
}
DEFINE_TRACE(BluetoothSupplement)
« no previous file with comments | « third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.h ('k') | third_party/WebKit/Source/modules/bluetooth/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698