OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "content/browser/renderer_host/surface_texture_transport_client_android .h" | 5 #include "content/browser/renderer_host/surface_texture_transport_client_android .h" |
6 | 6 |
7 #include <android/native_window_jni.h> | 7 #include <android/native_window_jni.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "cc/video_layer.h" | 10 #include "cc/video_layer.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 base::Bind( | 44 base::Bind( |
45 &SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable, | 45 &SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable, |
46 base::Unretained(this))); | 46 base::Unretained(this))); |
47 surface_texture_->DetachFromGLContext(); | 47 surface_texture_->DetachFromGLContext(); |
48 return video_layer_.get(); | 48 return video_layer_.get(); |
49 } | 49 } |
50 | 50 |
51 gfx::GLSurfaceHandle | 51 gfx::GLSurfaceHandle |
52 SurfaceTextureTransportClient::GetCompositingSurface(int surface_id) { | 52 SurfaceTextureTransportClient::GetCompositingSurface(int surface_id) { |
53 DCHECK(surface_id); | 53 DCHECK(surface_id); |
54 if (!window_) | 54 if (!window_) { |
55 window_ = surface_texture_->CreateSurface(); | 55 window_ = surface_texture_->CreateSurface(); |
56 ANativeWindow_acquire(window_); | |
no sievers
2013/01/28 19:46:15
Now we are leaking this extra ref.
Note that Creat
boliu
2013/01/28 20:47:09
GpuSurfaceTracker is not an android only class. Is
| |
57 } | |
56 | 58 |
57 GpuSurfaceTracker::Get()->SetNativeWidget(surface_id, window_); | 59 GpuSurfaceTracker::Get()->SetNativeWidget(surface_id, window_); |
58 return gfx::GLSurfaceHandle(gfx::kDummyPluginWindow, false); | 60 return gfx::GLSurfaceHandle(gfx::kDummyPluginWindow, false); |
59 } | 61 } |
60 | 62 |
61 void SurfaceTextureTransportClient::SetSize(const gfx::Size& size) { | 63 void SurfaceTextureTransportClient::SetSize(const gfx::Size& size) { |
62 surface_texture_->SetDefaultBufferSize(size.width(), size.height()); | 64 surface_texture_->SetDefaultBufferSize(size.width(), size.height()); |
63 video_layer_->setBounds(size); | 65 video_layer_->setBounds(size); |
64 video_frame_ = NULL; | 66 video_frame_ = NULL; |
65 } | 67 } |
(...skipping 25 matching lines...) Expand all Loading... | |
91 | 93 |
92 void SurfaceTextureTransportClient::PutCurrentFrame( | 94 void SurfaceTextureTransportClient::PutCurrentFrame( |
93 const scoped_refptr<media::VideoFrame>& frame) { | 95 const scoped_refptr<media::VideoFrame>& frame) { |
94 } | 96 } |
95 | 97 |
96 void SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable() { | 98 void SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable() { |
97 video_layer_->setNeedsDisplay(); | 99 video_layer_->setNeedsDisplay(); |
98 } | 100 } |
99 | 101 |
100 } // namespace content | 102 } // namespace content |
OLD | NEW |