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

Side by Side Diff: Source/web/WebMediaPlayerClientImpl.cpp

Issue 423633002: Make HTMLMediaElement.setMediaKeys() asynchronous. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "config.h" 5 #include "config.h"
6 #include "web/WebMediaPlayerClientImpl.h" 6 #include "web/WebMediaPlayerClientImpl.h"
7 7
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/html/HTMLMediaElement.h" 9 #include "core/html/HTMLMediaElement.h"
10 #include "core/html/TimeRanges.h" 10 #include "core/html/TimeRanges.h"
11 #include "core/rendering/RenderView.h" 11 #include "core/rendering/RenderView.h"
12 #include "core/rendering/compositing/RenderLayerCompositor.h" 12 #include "core/rendering/compositing/RenderLayerCompositor.h"
13 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h" 13 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h"
14 #include "modules/encryptedmedia/MediaKeyNeededEvent.h" 14 #include "modules/encryptedmedia/MediaKeyNeededEvent.h"
15 #include "modules/mediastream/MediaStreamRegistry.h" 15 #include "modules/mediastream/MediaStreamRegistry.h"
16 #include "platform/ContentDecryptionModuleResult.h"
16 #include "platform/audio/AudioBus.h" 17 #include "platform/audio/AudioBus.h"
17 #include "platform/audio/AudioSourceProviderClient.h" 18 #include "platform/audio/AudioSourceProviderClient.h"
18 #include "platform/geometry/IntSize.h" 19 #include "platform/geometry/IntSize.h"
19 #include "platform/graphics/GraphicsContext.h" 20 #include "platform/graphics/GraphicsContext.h"
20 #include "platform/graphics/GraphicsLayer.h" 21 #include "platform/graphics/GraphicsLayer.h"
21 #include "platform/graphics/gpu/Extensions3DUtil.h" 22 #include "platform/graphics/gpu/Extensions3DUtil.h"
22 #include "platform/graphics/skia/GaneshUtils.h" 23 #include "platform/graphics/skia/GaneshUtils.h"
23 #include "public/platform/Platform.h" 24 #include "public/platform/Platform.h"
24 #include "public/platform/WebAudioSourceProvider.h" 25 #include "public/platform/WebAudioSourceProvider.h"
25 #include "public/platform/WebCString.h" 26 #include "public/platform/WebCString.h"
(...skipping 19 matching lines...) Expand all
45 #endif 46 #endif
46 47
47 48
48 #include "wtf/Assertions.h" 49 #include "wtf/Assertions.h"
49 #include "wtf/text/CString.h" 50 #include "wtf/text/CString.h"
50 51
51 using namespace blink; 52 using namespace blink;
52 53
53 namespace blink { 54 namespace blink {
54 55
56 // Represents the result used when setContentDecryptionModule() is called.
57 // This happens asynchronously. Since there is no way to report an error,
ddorwin 2014/07/31 00:56:36 This is the scenario xhwang was referring to in th
jrummell 2014/08/07 01:43:02 Remove this in favor of having a synchronous metho
58 // simply ignore any result.
59 class IgnoreResponseContentDecryptionModuleResult FINAL : public ContentDecrypti onModuleResult {
ddorwin 2014/07/31 00:56:36 We should come up with a better name, especially i
jrummell 2014/08/07 01:43:02 Gone.
60 public:
61 IgnoreResponseContentDecryptionModuleResult() { }
62
63 // ContentDecryptionModuleResult implementation.
64 virtual void complete() OVERRIDE { }
65 virtual void completeWithSession(blink::WebContentDecryptionModuleResult::Se ssionStatus status) OVERRIDE { }
66 virtual void completeWithError(blink::WebContentDecryptionModuleException co de, unsigned long systemCode, const blink::WebString& message) OVERRIDE { }
67 };
68
55 static PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(WebMediaPlayerClient* cli ent, const WebURL& url, LocalFrame* frame) 69 static PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(WebMediaPlayerClient* cli ent, const WebURL& url, LocalFrame* frame)
56 { 70 {
57 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame); 71 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame);
58 72
59 if (!webFrame || !webFrame->client()) 73 if (!webFrame || !webFrame->client())
60 return nullptr; 74 return nullptr;
61 return adoptPtr(webFrame->client()->createMediaPlayer(webFrame, url, client) ); 75 return adoptPtr(webFrame->client()->createMediaPlayer(webFrame, url, client) );
62 } 76 }
63 77
64 WebMediaPlayer* WebMediaPlayerClientImpl::webMediaPlayer() const 78 WebMediaPlayer* WebMediaPlayerClientImpl::webMediaPlayer() const
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 #endif 227 #endif
214 228
215 m_webMediaPlayer->setVolume(mediaElement().playerVolume()); 229 m_webMediaPlayer->setVolume(mediaElement().playerVolume());
216 230
217 m_webMediaPlayer->setPoster(poster); 231 m_webMediaPlayer->setPoster(poster);
218 232
219 #if OS(ANDROID) 233 #if OS(ANDROID)
220 m_usePaintOnAndroid = (loadType != WebMediaPlayer::LoadTypeMediaStream); 234 m_usePaintOnAndroid = (loadType != WebMediaPlayer::LoadTypeMediaStream);
221 #endif 235 #endif
222 236
223 // Tell WebMediaPlayer about any connected CDM (may be null). 237 // Tell WebMediaPlayer about any connected CDM (may be null). Ignore any
224 m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia: :contentDecryptionModule(mediaElement())); 238 // errors that happen while setting the CDM.
239 ContentDecryptionModuleResult* result = new IgnoreResponseContentDecryptionM oduleResult();
240 m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia: :contentDecryptionModule(mediaElement()), result->result());
ddorwin 2014/07/31 00:56:36 Hmm, I wonder if this needs to be synchronous due
jrummell 2014/08/07 01:43:02 Done.
225 m_webMediaPlayer->load(loadType, kurl, corsMode); 241 m_webMediaPlayer->load(loadType, kurl, corsMode);
226 } 242 }
227 243
228 244
229 void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re ct) 245 void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re ct)
230 { 246 {
231 // Normally GraphicsContext operations do nothing when painting is disabled. 247 // Normally GraphicsContext operations do nothing when painting is disabled.
232 // Since we're accessing platformContext() directly we have to manually 248 // Since we're accessing platformContext() directly we have to manually
233 // check. 249 // check.
234 if (m_webMediaPlayer && !context->paintingDisabled()) { 250 if (m_webMediaPlayer && !context->paintingDisabled()) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 392
377 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) 393 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate)
378 { 394 {
379 if (m_client) 395 if (m_client)
380 m_client->setFormat(numberOfChannels, sampleRate); 396 m_client->setFormat(numberOfChannels, sampleRate);
381 } 397 }
382 398
383 #endif 399 #endif
384 400
385 } // namespace blink 401 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698