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

Side by Side Diff: cc/layers/video_layer.cc

Issue 2140783002: services/ui: Detect when a video is playing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tot merge Created 4 years, 4 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
« no previous file with comments | « cc/layers/layer_unittest.cc ('k') | cc/layers/video_layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 "cc/layers/video_layer.h" 5 #include "cc/layers/video_layer.h"
6 6
7 #include "cc/layers/video_layer_impl.h" 7 #include "cc/layers/video_layer_impl.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
11 scoped_refptr<VideoLayer> VideoLayer::Create( 11 scoped_refptr<VideoLayer> VideoLayer::Create(
12 VideoFrameProvider* provider, 12 VideoFrameProvider* provider,
13 media::VideoRotation video_rotation) { 13 media::VideoRotation video_rotation) {
14 return make_scoped_refptr(new VideoLayer(provider, video_rotation)); 14 return make_scoped_refptr(new VideoLayer(provider, video_rotation));
15 } 15 }
16 16
17 VideoLayer::VideoLayer(VideoFrameProvider* provider, 17 VideoLayer::VideoLayer(VideoFrameProvider* provider,
18 media::VideoRotation video_rotation) 18 media::VideoRotation video_rotation)
19 : provider_(provider), video_rotation_(video_rotation) { 19 : provider_(provider), video_rotation_(video_rotation) {
20 SetMayContainVideo(true);
20 DCHECK(provider_); 21 DCHECK(provider_);
21 } 22 }
22 23
23 VideoLayer::~VideoLayer() {} 24 VideoLayer::~VideoLayer() {}
24 25
25 std::unique_ptr<LayerImpl> VideoLayer::CreateLayerImpl( 26 std::unique_ptr<LayerImpl> VideoLayer::CreateLayerImpl(
26 LayerTreeImpl* tree_impl) { 27 LayerTreeImpl* tree_impl) {
27 return VideoLayerImpl::Create(tree_impl, id(), provider_, video_rotation_); 28 return VideoLayerImpl::Create(tree_impl, id(), provider_, video_rotation_);
28 } 29 }
29 30
30 bool VideoLayer::Update() { 31 bool VideoLayer::Update() {
31 bool updated = Layer::Update(); 32 bool updated = Layer::Update();
32 33
33 // Video layer doesn't update any resources from the main thread side, 34 // Video layer doesn't update any resources from the main thread side,
34 // but repaint rects need to be sent to the VideoLayerImpl via commit. 35 // but repaint rects need to be sent to the VideoLayerImpl via commit.
35 // 36 //
36 // This is the inefficient legacy redraw path for videos. It's better to 37 // This is the inefficient legacy redraw path for videos. It's better to
37 // communicate this directly to the VideoLayerImpl. 38 // communicate this directly to the VideoLayerImpl.
38 updated |= !update_rect().IsEmpty(); 39 updated |= !update_rect().IsEmpty();
39 40
40 return updated; 41 return updated;
41 } 42 }
42 43
43 void VideoLayer::StopUsingProvider() { 44 void VideoLayer::StopUsingProvider() {
44 provider_ = nullptr; 45 provider_ = nullptr;
45 } 46 }
46 47
47 } // namespace cc 48 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_unittest.cc ('k') | cc/layers/video_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698