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

Unified Diff: third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.cpp

Issue 2668753006: Special-case LocalDOMWindow for same-origin access in bindings. (Closed)
Patch Set: Rebase and address comments. Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.cpp b/third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.cpp
index 4aa08ad30d7841caab43cbab65828947d2b76d68..440475376dbb61a2be086326b1b42dd0a2338a52 100644
--- a/third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.cpp
@@ -7,39 +7,13 @@
#include "core/dom/Document.h"
#include "core/frame/LocalDOMWindow.h"
#include "core/frame/LocalFrame.h"
-#include "modules/webaudio/AudioWorklet.h"
namespace blink {
-WindowAudioWorklet::WindowAudioWorklet(LocalDOMWindow& window)
- : ContextLifecycleObserver(window.frame()->document()) {}
-
-const char* WindowAudioWorklet::supplementName() {
- return "WindowAudioWorklet";
-}
-
-WindowAudioWorklet& WindowAudioWorklet::from(LocalDOMWindow& window) {
- WindowAudioWorklet* supplement = static_cast<WindowAudioWorklet*>(
- Supplement<LocalDOMWindow>::from(window, supplementName()));
- if (!supplement) {
- supplement = new WindowAudioWorklet(window);
- provideTo(window, supplementName(), supplement);
- }
- return *supplement;
-}
-
-Worklet* WindowAudioWorklet::audioWorklet(DOMWindow& window) {
+AudioWorklet* WindowAudioWorklet::audioWorklet(LocalDOMWindow& window) {
if (!window.frame())
return nullptr;
- return from(toLocalDOMWindow(window)).audioWorklet(toLocalDOMWindow(window));
-}
-
-AudioWorklet* WindowAudioWorklet::audioWorklet(LocalDOMWindow& window) {
- if (!m_audioWorklet && getExecutionContext()) {
- DCHECK(window.frame());
- m_audioWorklet = AudioWorklet::create(window.frame());
- }
- return m_audioWorklet.get();
+ return from(window).m_audioWorklet.get();
}
// Break the following cycle when the context gets detached.
@@ -61,4 +35,24 @@ DEFINE_TRACE(WindowAudioWorklet) {
ContextLifecycleObserver::trace(visitor);
}
+WindowAudioWorklet& WindowAudioWorklet::from(LocalDOMWindow& window) {
+ WindowAudioWorklet* supplement = static_cast<WindowAudioWorklet*>(
+ Supplement<LocalDOMWindow>::from(window, supplementName()));
+ if (!supplement) {
+ supplement = new WindowAudioWorklet(window);
+ provideTo(window, supplementName(), supplement);
+ }
+ return *supplement;
+}
+
+WindowAudioWorklet::WindowAudioWorklet(LocalDOMWindow& window)
+ : ContextLifecycleObserver(window.frame()->document()),
+ m_audioWorklet(AudioWorklet::create(window.frame())) {
+ DCHECK(getExecutionContext());
+}
+
+const char* WindowAudioWorklet::supplementName() {
+ return "WindowAudioWorklet";
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698