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

Side by Side Diff: third_party/WebKit/Source/modules/mediasession/MediaSession.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/mediasession/MediaSession.h" 5 #include "modules/mediasession/MediaSession.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
11 #include "core/dom/ExceptionCode.h" 11 #include "core/dom/ExceptionCode.h"
12 #include "core/frame/LocalDOMWindow.h" 12 #include "core/frame/LocalDOMWindow.h"
13 #include "core/frame/LocalFrame.h" 13 #include "core/frame/LocalFrame.h"
14 #include "core/loader/FrameLoaderClient.h" 14 #include "core/loader/FrameLoaderClient.h"
15 #include "modules/mediasession/MediaMetadata.h" 15 #include "modules/mediasession/MediaMetadata.h"
16 #include "modules/mediasession/MediaSessionError.h" 16 #include "modules/mediasession/MediaSessionError.h"
17 #include <memory>
18 17
19 namespace blink { 18 namespace blink {
20 19
21 MediaSession::MediaSession(std::unique_ptr<WebMediaSession> webMediaSession) 20 MediaSession::MediaSession(PassOwnPtr<WebMediaSession> webMediaSession)
22 : m_webMediaSession(std::move(webMediaSession)) 21 : m_webMediaSession(std::move(webMediaSession))
23 { 22 {
24 DCHECK(m_webMediaSession); 23 DCHECK(m_webMediaSession);
25 } 24 }
26 25
27 MediaSession* MediaSession::create(ExecutionContext* context, ExceptionState& ex ceptionState) 26 MediaSession* MediaSession::create(ExecutionContext* context, ExceptionState& ex ceptionState)
28 { 27 {
29 Document* document = toDocument(context); 28 Document* document = toDocument(context);
30 LocalFrame* frame = document->frame(); 29 LocalFrame* frame = document->frame();
31 FrameLoaderClient* client = frame->loader().client(); 30 FrameLoaderClient* client = frame->loader().client();
32 std::unique_ptr<WebMediaSession> webMediaSession = client->createWebMediaSes sion(); 31 OwnPtr<WebMediaSession> webMediaSession = client->createWebMediaSession();
33 if (!webMediaSession) { 32 if (!webMediaSession) {
34 exceptionState.throwDOMException(NotSupportedError, "Missing platform im plementation."); 33 exceptionState.throwDOMException(NotSupportedError, "Missing platform im plementation.");
35 return nullptr; 34 return nullptr;
36 } 35 }
37 return new MediaSession(std::move(webMediaSession)); 36 return new MediaSession(std::move(webMediaSession));
38 } 37 }
39 38
40 ScriptPromise MediaSession::activate(ScriptState* scriptState) 39 ScriptPromise MediaSession::activate(ScriptState* scriptState)
41 { 40 {
42 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 41 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
(...skipping 27 matching lines...) Expand all
70 { 69 {
71 return m_metadata; 70 return m_metadata;
72 } 71 }
73 72
74 DEFINE_TRACE(MediaSession) 73 DEFINE_TRACE(MediaSession)
75 { 74 {
76 visitor->trace(m_metadata); 75 visitor->trace(m_metadata);
77 } 76 }
78 77
79 } // namespace blink 78 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698