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

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

Issue 2727633006: DevTools: Rename InspectorInstrumentation:: namespace into probe:: (Closed)
Patch Set: Created 3 years, 9 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 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 23 matching lines...) Expand all
34 case WebRemotePlaybackState::Disconnected: 34 case WebRemotePlaybackState::Disconnected:
35 return disconnectedValue; 35 return disconnectedValue;
36 } 36 }
37 37
38 ASSERT_NOT_REACHED(); 38 ASSERT_NOT_REACHED();
39 return disconnectedValue; 39 return disconnectedValue;
40 } 40 }
41 41
42 void runNotifyInitialAvailabilityTask(ExecutionContext* context, 42 void runNotifyInitialAvailabilityTask(ExecutionContext* context,
43 std::unique_ptr<WTF::Closure> task) { 43 std::unique_ptr<WTF::Closure> task) {
44 InspectorInstrumentation::AsyncTask asyncTask(context, task.get()); 44 probe::AsyncTask asyncTask(context, task.get());
45 (*task)(); 45 (*task)();
46 } 46 }
47 47
48 } // anonymous namespace 48 } // anonymous namespace
49 49
50 // static 50 // static
51 RemotePlayback* RemotePlayback::create(HTMLMediaElement& element) { 51 RemotePlayback* RemotePlayback::create(HTMLMediaElement& element) {
52 return new RemotePlayback(element); 52 return new RemotePlayback(element);
53 } 53 }
54 54
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 .insert(id, TraceWrapperMember<RemotePlaybackAvailabilityCallback>( 94 .insert(id, TraceWrapperMember<RemotePlaybackAvailabilityCallback>(
95 this, callback)) 95 this, callback))
96 .isNewEntry); 96 .isNewEntry);
97 97
98 // Report the current availability via the callback. 98 // Report the current availability via the callback.
99 // TODO(yuryu): Wrapping notifyInitialAvailability with WTF::Closure as 99 // TODO(yuryu): Wrapping notifyInitialAvailability with WTF::Closure as
100 // InspectorInstrumentation requires a globally unique pointer to track tasks. 100 // InspectorInstrumentation requires a globally unique pointer to track tasks.
101 // We can remove the wrapper if InspectorInstrumentation returns a task id. 101 // We can remove the wrapper if InspectorInstrumentation returns a task id.
102 std::unique_ptr<WTF::Closure> task = WTF::bind( 102 std::unique_ptr<WTF::Closure> task = WTF::bind(
103 &RemotePlayback::notifyInitialAvailability, wrapPersistent(this), id); 103 &RemotePlayback::notifyInitialAvailability, wrapPersistent(this), id);
104 InspectorInstrumentation::asyncTaskScheduled( 104 probe::asyncTaskScheduled(getExecutionContext(), "watchAvailabilityCallback",
105 getExecutionContext(), "watchAvailabilityCallback", task.get()); 105 task.get());
106 TaskRunnerHelper::get(TaskType::MediaElementEvent, getExecutionContext()) 106 TaskRunnerHelper::get(TaskType::MediaElementEvent, getExecutionContext())
107 ->postTask(BLINK_FROM_HERE, 107 ->postTask(BLINK_FROM_HERE,
108 WTF::bind(runNotifyInitialAvailabilityTask, 108 WTF::bind(runNotifyInitialAvailabilityTask,
109 wrapPersistent(getExecutionContext()), 109 wrapPersistent(getExecutionContext()),
110 WTF::passed(std::move(task)))); 110 WTF::passed(std::move(task))));
111 111
112 // TODO(avayvod): Currently the availability is tracked for each media element 112 // TODO(avayvod): Currently the availability is tracked for each media element
113 // as soon as it's created, we probably want to limit that to when the 113 // as soon as it's created, we probably want to limit that to when the
114 // page/element is visible (see https://crbug.com/597281) and has default 114 // page/element is visible (see https://crbug.com/597281) and has default
115 // controls. If there are no default controls, we should also start tracking 115 // controls. If there are no default controls, we should also start tracking
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 } 314 }
315 315
316 DEFINE_TRACE_WRAPPERS(RemotePlayback) { 316 DEFINE_TRACE_WRAPPERS(RemotePlayback) {
317 for (auto callback : m_availabilityCallbacks.values()) { 317 for (auto callback : m_availabilityCallbacks.values()) {
318 visitor->traceWrappers(callback); 318 visitor->traceWrappers(callback);
319 } 319 }
320 EventTargetWithInlineData::traceWrappers(visitor); 320 EventTargetWithInlineData::traceWrappers(visitor);
321 } 321 }
322 322
323 } // namespace blink 323 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698