Save errno for logging before potentially overwriting it.
[chromium-blink-merge.git] / content / browser / renderer_host / surface_texture_transport_client_android.h
blob83d917552dc132612ecb5e006dc3c28325fa1b7d
1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_SURFACE_TEXTURE_TRANSPORT_CLIENT_ANDROID_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_SURFACE_TEXTURE_TRANSPORT_CLIENT_ANDROID_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "cc/layers/video_frame_provider.h"
12 #include "gpu/command_buffer/common/mailbox.h"
13 #include "ui/gfx/native_widget_types.h"
14 #include "ui/gfx/size.h"
16 struct ANativeWindow;
18 namespace cc {
19 class Layer;
20 class VideoLayer;
23 namespace gfx {
24 class SurfaceTextureBridge;
27 namespace content {
29 class SurfaceTextureTransportClient : public cc::VideoFrameProvider {
30 public:
31 SurfaceTextureTransportClient();
32 virtual ~SurfaceTextureTransportClient();
34 scoped_refptr<cc::Layer> Initialize();
35 gfx::GLSurfaceHandle GetCompositingSurface(int surface_id);
36 void SetSize(const gfx::Size& size);
38 // cc::VideoFrameProvider implementation.
39 virtual void SetVideoFrameProviderClient(Client*) OVERRIDE {}
40 virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() OVERRIDE;
41 virtual void PutCurrentFrame(const scoped_refptr<media::VideoFrame>& frame)
42 OVERRIDE;
44 private:
45 void OnSurfaceTextureFrameAvailable();
47 scoped_refptr<cc::VideoLayer> video_layer_;
48 scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_;
49 ANativeWindow* window_;
50 scoped_refptr<media::VideoFrame> video_frame_;
51 uint32 texture_id_;
52 gpu::Mailbox texture_mailbox_;
53 uint32 texture_mailbox_sync_point_;
54 int surface_id_;
55 base::WeakPtrFactory<SurfaceTextureTransportClient> weak_factory_;
57 DISALLOW_COPY_AND_ASSIGN(SurfaceTextureTransportClient);
60 } // namespace content
62 #endif // CONTENT_BROWSER_RENDERER_HOST_SURFACE_TEXTURE_TRANSPORT_CLIENT_ANDROID_H_