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

Side by Side Diff: third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp

Issue 2484973005: [Blink, RemotePlaybackAPI] Create WebRemotePlaybackClient in HTMLMediaElement ctor to avoid lazy in… (Closed)
Patch Set: Fixed compile for EmptyClients.cpp Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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/remoteplayback/RemotePlayback.h" 5 #include "modules/remoteplayback/RemotePlayback.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "bindings/modules/v8/RemotePlaybackAvailabilityCallback.h" 8 #include "bindings/modules/v8/RemotePlaybackAvailabilityCallback.h"
9 #include "core/HTMLNames.h" 9 #include "core/HTMLNames.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
(...skipping 27 matching lines...) Expand all
38 } 38 }
39 39
40 } // anonymous namespace 40 } // anonymous namespace
41 41
42 // static 42 // static
43 RemotePlayback* RemotePlayback::create(ScriptState* scriptState, 43 RemotePlayback* RemotePlayback::create(ScriptState* scriptState,
44 HTMLMediaElement& element) { 44 HTMLMediaElement& element) {
45 DCHECK(element.document().frame()); 45 DCHECK(element.document().frame());
46 DCHECK(scriptState); 46 DCHECK(scriptState);
47 47
48 RemotePlayback* remotePlayback = new RemotePlayback(scriptState, element); 48 return new RemotePlayback(scriptState, element);
49 element.setRemotePlaybackClient(remotePlayback);
50
51 return remotePlayback;
52 } 49 }
53 50
54 RemotePlayback::RemotePlayback(ScriptState* scriptState, 51 RemotePlayback::RemotePlayback(ScriptState* scriptState,
55 HTMLMediaElement& element) 52 HTMLMediaElement& element)
56 : ActiveScriptWrappable(this), 53 : ActiveScriptWrappable(this),
57 m_scriptState(scriptState), 54 m_scriptState(scriptState),
58 m_state(element.isPlayingRemotely() 55 m_state(element.isPlayingRemotely()
59 ? WebRemotePlaybackState::Connected 56 ? WebRemotePlaybackState::Connected
60 : WebRemotePlaybackState::Disconnected), 57 : WebRemotePlaybackState::Disconnected),
61 m_availability(element.hasRemoteRoutes()), 58 m_availability(element.hasRemoteRoutes()),
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } 284 }
288 285
289 DEFINE_TRACE_WRAPPERS(RemotePlayback) { 286 DEFINE_TRACE_WRAPPERS(RemotePlayback) {
290 for (auto callback : m_availabilityCallbacks.values()) { 287 for (auto callback : m_availabilityCallbacks.values()) {
291 visitor->traceWrappers(callback); 288 visitor->traceWrappers(callback);
292 } 289 }
293 EventTargetWithInlineData::traceWrappers(visitor); 290 EventTargetWithInlineData::traceWrappers(visitor);
294 } 291 }
295 292
296 } // namespace blink 293 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698