Chromium Code Reviews| 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/common/gpu/image_transport_surface.h" | 5 #include "content/common/gpu/image_transport_surface.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
| 10 #include "content/common/gpu/gpu_channel_manager.h" | 10 #include "content/common/gpu/gpu_channel_manager.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 void DoWakeUpGpu(); | 53 void DoWakeUpGpu(); |
| 54 | 54 |
| 55 uint32 parent_client_id_; | 55 uint32 parent_client_id_; |
| 56 base::TimeTicks begin_wake_up_time_; | 56 base::TimeTicks begin_wake_up_time_; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 class DirectSurfaceAndroid : public PassThroughImageTransportSurface { | 59 class DirectSurfaceAndroid : public PassThroughImageTransportSurface { |
| 60 public: | 60 public: |
| 61 DirectSurfaceAndroid(GpuChannelManager* manager, | 61 DirectSurfaceAndroid(GpuChannelManager* manager, |
| 62 GpuCommandBufferStub* stub, | 62 GpuCommandBufferStub* stub, |
| 63 gfx::GLSurface* surface, | 63 gfx::GLSurface* surface); |
| 64 bool transport); | |
| 65 | 64 |
| 66 // gfx::GLSurface implementation. | 65 // gfx::GLSurface implementation. |
| 67 virtual bool SwapBuffers() OVERRIDE; | 66 virtual bool SwapBuffers() OVERRIDE; |
| 68 | 67 |
| 69 protected: | 68 protected: |
| 70 virtual ~DirectSurfaceAndroid(); | 69 virtual ~DirectSurfaceAndroid(); |
| 71 | 70 |
| 72 private: | 71 private: |
| 73 DISALLOW_COPY_AND_ASSIGN(DirectSurfaceAndroid); | 72 DISALLOW_COPY_AND_ASSIGN(DirectSurfaceAndroid); |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 ImageTransportSurfaceAndroid::ImageTransportSurfaceAndroid( | 75 ImageTransportSurfaceAndroid::ImageTransportSurfaceAndroid( |
| 77 GpuChannelManager* manager, | 76 GpuChannelManager* manager, |
| 78 GpuCommandBufferStub* stub, | 77 GpuCommandBufferStub* stub, |
| 79 gfx::GLSurface* surface, | 78 gfx::GLSurface* surface, |
| 80 uint32 parent_client_id) | 79 uint32 parent_client_id) |
| 81 : PassThroughImageTransportSurface(manager, stub, surface, true), | 80 : PassThroughImageTransportSurface(manager, stub, surface), |
|
piman
2014/04/25 05:41:14
This is the only one that was setting it to true.
no sievers
2014/04/25 17:51:00
Should be fine. We don't expect glSwapBuffers() or
| |
| 82 parent_client_id_(parent_client_id) {} | 81 parent_client_id_(parent_client_id) {} |
| 83 | 82 |
| 84 ImageTransportSurfaceAndroid::~ImageTransportSurfaceAndroid() {} | 83 ImageTransportSurfaceAndroid::~ImageTransportSurfaceAndroid() {} |
| 85 | 84 |
| 86 bool ImageTransportSurfaceAndroid::Initialize() { | 85 bool ImageTransportSurfaceAndroid::Initialize() { |
| 87 if (!surface()) | 86 if (!surface()) |
| 88 return false; | 87 return false; |
| 89 | 88 |
| 90 if (!PassThroughImageTransportSurface::Initialize()) | 89 if (!PassThroughImageTransportSurface::Initialize()) |
| 91 return false; | 90 return false; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 void ImageTransportSurfaceAndroid::DoWakeUpGpu() { | 140 void ImageTransportSurfaceAndroid::DoWakeUpGpu() { |
| 142 if (!GetHelper()->stub()->decoder() || | 141 if (!GetHelper()->stub()->decoder() || |
| 143 !GetHelper()->stub()->decoder()->MakeCurrent()) | 142 !GetHelper()->stub()->decoder()->MakeCurrent()) |
| 144 return; | 143 return; |
| 145 glFinish(); | 144 glFinish(); |
| 146 DidAccessGpu(); | 145 DidAccessGpu(); |
| 147 } | 146 } |
| 148 | 147 |
| 149 DirectSurfaceAndroid::DirectSurfaceAndroid(GpuChannelManager* manager, | 148 DirectSurfaceAndroid::DirectSurfaceAndroid(GpuChannelManager* manager, |
| 150 GpuCommandBufferStub* stub, | 149 GpuCommandBufferStub* stub, |
| 151 gfx::GLSurface* surface, | 150 gfx::GLSurface* surface) |
| 152 bool transport) | 151 : PassThroughImageTransportSurface(manager, stub, surface) {} |
| 153 : PassThroughImageTransportSurface(manager, stub, surface, transport) {} | |
| 154 | 152 |
| 155 DirectSurfaceAndroid::~DirectSurfaceAndroid() {} | 153 DirectSurfaceAndroid::~DirectSurfaceAndroid() {} |
| 156 | 154 |
| 157 bool DirectSurfaceAndroid::SwapBuffers() { | 155 bool DirectSurfaceAndroid::SwapBuffers() { |
| 158 DidAccessGpu(); | 156 DidAccessGpu(); |
| 159 return PassThroughImageTransportSurface::SwapBuffers(); | 157 return PassThroughImageTransportSurface::SwapBuffers(); |
| 160 } | 158 } |
| 161 | 159 |
| 162 } // anonymous namespace | 160 } // anonymous namespace |
| 163 | 161 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 181 stub->surface_id()); | 179 stub->surface_id()); |
| 182 scoped_refptr<gfx::GLSurface> surface = | 180 scoped_refptr<gfx::GLSurface> surface = |
| 183 new gfx::NativeViewGLSurfaceEGL(window); | 181 new gfx::NativeViewGLSurfaceEGL(window); |
| 184 bool initialize_success = surface->Initialize(); | 182 bool initialize_success = surface->Initialize(); |
| 185 if (window) | 183 if (window) |
| 186 ANativeWindow_release(window); | 184 ANativeWindow_release(window); |
| 187 if (!initialize_success) | 185 if (!initialize_success) |
| 188 return scoped_refptr<gfx::GLSurface>(); | 186 return scoped_refptr<gfx::GLSurface>(); |
| 189 | 187 |
| 190 return scoped_refptr<gfx::GLSurface>( | 188 return scoped_refptr<gfx::GLSurface>( |
| 191 new DirectSurfaceAndroid(manager, stub, surface.get(), false)); | 189 new DirectSurfaceAndroid(manager, stub, surface.get())); |
| 192 } | 190 } |
| 193 | 191 |
| 194 } // namespace content | 192 } // namespace content |
| OLD | NEW |