Log mixed script shield events.
[chromium-blink-merge.git] / cc / layers / video_frame_provider_client_impl.h
blobb6eb86f0fef659d4b4928cde60e416c3cb4026af
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_LAYERS_VIDEO_FRAME_PROVIDER_CLIENT_IMPL_H_
6 #define CC_LAYERS_VIDEO_FRAME_PROVIDER_CLIENT_IMPL_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/synchronization/lock.h"
10 #include "cc/layers/video_frame_provider.h"
11 #include "ui/gfx/transform.h"
13 namespace media { class VideoFrame; }
15 namespace cc {
16 class VideoLayerImpl;
18 class VideoFrameProviderClientImpl
19 : public VideoFrameProvider::Client,
20 public base::RefCounted<VideoFrameProviderClientImpl> {
21 public:
22 static scoped_refptr<VideoFrameProviderClientImpl> Create(
23 VideoFrameProvider* provider);
25 VideoLayerImpl* active_video_layer() { return active_video_layer_; }
26 void set_active_video_layer(VideoLayerImpl* video_layer) {
27 active_video_layer_ = video_layer;
30 void Stop();
31 bool Stopped() const { return !provider_; }
33 scoped_refptr<media::VideoFrame> AcquireLockAndCurrentFrame();
34 void PutCurrentFrame(const scoped_refptr<media::VideoFrame>& frame);
35 void ReleaseLock();
36 const gfx::Transform& stream_texture_matrix() const {
37 return stream_texture_matrix_;
40 // VideoFrameProvider::Client implementation. These methods are all callable
41 // on any thread.
42 void StopUsingProvider() override;
43 void DidReceiveFrame() override;
44 void DidUpdateMatrix(const float* matrix) override;
46 private:
47 explicit VideoFrameProviderClientImpl(VideoFrameProvider* provider);
48 friend class base::RefCounted<VideoFrameProviderClientImpl>;
49 ~VideoFrameProviderClientImpl() override;
51 VideoLayerImpl* active_video_layer_;
53 // Guards the destruction of provider_ and the frame that it provides
54 base::Lock provider_lock_;
55 VideoFrameProvider* provider_;
57 gfx::Transform stream_texture_matrix_;
59 DISALLOW_COPY_AND_ASSIGN(VideoFrameProviderClientImpl);
62 } // namespace cc
64 #endif // CC_LAYERS_VIDEO_FRAME_PROVIDER_CLIENT_IMPL_H_