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

Side by Side Diff: content/browser/renderer_host/surface_texture_transport_client_android.cc

Issue 12774006: cc: Chromify Layer and LayerImpl classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MoreAndroidCompilings Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
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 24 matching lines...) Expand all
35 if (surface_id_) { 35 if (surface_id_) {
36 GpuSurfaceTracker::Get()->SetNativeWidget( 36 GpuSurfaceTracker::Get()->SetNativeWidget(
37 surface_id_, gfx::kNullAcceleratedWidget); 37 surface_id_, gfx::kNullAcceleratedWidget);
38 } 38 }
39 if (window_) 39 if (window_)
40 ANativeWindow_release(window_); 40 ANativeWindow_release(window_);
41 } 41 }
42 42
43 scoped_refptr<cc::Layer> SurfaceTextureTransportClient::Initialize() { 43 scoped_refptr<cc::Layer> SurfaceTextureTransportClient::Initialize() {
44 // Use a SurfaceTexture to stream frames to the UI thread. 44 // Use a SurfaceTexture to stream frames to the UI thread.
45 video_layer_ = cc::VideoLayer::create(this); 45 video_layer_ = cc::VideoLayer::Create(this);
46 46
47 surface_texture_ = new SurfaceTextureBridge(0); 47 surface_texture_ = new SurfaceTextureBridge(0);
48 surface_texture_->SetFrameAvailableCallback( 48 surface_texture_->SetFrameAvailableCallback(
49 base::Bind( 49 base::Bind(
50 &SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable, 50 &SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable,
51 base::Unretained(this))); 51 base::Unretained(this)));
52 surface_texture_->DetachFromGLContext(); 52 surface_texture_->DetachFromGLContext();
53 return video_layer_.get(); 53 return video_layer_.get();
54 } 54 }
55 55
56 gfx::GLSurfaceHandle 56 gfx::GLSurfaceHandle
57 SurfaceTextureTransportClient::GetCompositingSurface(int surface_id) { 57 SurfaceTextureTransportClient::GetCompositingSurface(int surface_id) {
58 DCHECK(surface_id); 58 DCHECK(surface_id);
59 surface_id_ = surface_id; 59 surface_id_ = surface_id;
60 60
61 if (!window_) 61 if (!window_)
62 window_ = surface_texture_->CreateSurface(); 62 window_ = surface_texture_->CreateSurface();
63 63
64 GpuSurfaceTracker::Get()->SetNativeWidget(surface_id, window_); 64 GpuSurfaceTracker::Get()->SetNativeWidget(surface_id, window_);
65 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NATIVE_DIRECT); 65 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NATIVE_DIRECT);
66 } 66 }
67 67
68 void SurfaceTextureTransportClient::SetSize(const gfx::Size& size) { 68 void SurfaceTextureTransportClient::SetSize(const gfx::Size& size) {
69 surface_texture_->SetDefaultBufferSize(size.width(), size.height()); 69 surface_texture_->SetDefaultBufferSize(size.width(), size.height());
70 video_layer_->setBounds(size); 70 video_layer_->SetBounds(size);
71 video_frame_ = NULL; 71 video_frame_ = NULL;
72 } 72 }
73 73
74 scoped_refptr<media::VideoFrame> SurfaceTextureTransportClient:: 74 scoped_refptr<media::VideoFrame> SurfaceTextureTransportClient::
75 GetCurrentFrame() { 75 GetCurrentFrame() {
76 if (!texture_id_) { 76 if (!texture_id_) {
77 WebKit::WebGraphicsContext3D* context = 77 WebKit::WebGraphicsContext3D* context =
78 ImageTransportFactoryAndroid::GetInstance()->GetContext3D(); 78 ImageTransportFactoryAndroid::GetInstance()->GetContext3D();
79 context->makeContextCurrent(); 79 context->makeContextCurrent();
80 texture_id_ = context->createTexture(); 80 texture_id_ = context->createTexture();
(...skipping 13 matching lines...) Expand all
94 surface_texture_->UpdateTexImage(); 94 surface_texture_->UpdateTexImage();
95 95
96 return video_frame_; 96 return video_frame_;
97 } 97 }
98 98
99 void SurfaceTextureTransportClient::PutCurrentFrame( 99 void SurfaceTextureTransportClient::PutCurrentFrame(
100 const scoped_refptr<media::VideoFrame>& frame) { 100 const scoped_refptr<media::VideoFrame>& frame) {
101 } 101 }
102 102
103 void SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable() { 103 void SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable() {
104 video_layer_->setNeedsDisplay(); 104 video_layer_->SetNeedsDisplay();
105 } 105 }
106 106
107 } // namespace content 107 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698