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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "content/common/gpu/image_transport_surface.h" | 7 #include "content/common/gpu/image_transport_surface.h" |
8 | 8 |
9 // Out of order because it has conflicts with other includes on Windows. | 9 // Out of order because it has conflicts with other includes on Windows. |
10 #include "third_party/angle/include/EGL/egl.h" | 10 #include "third_party/angle/include/EGL/egl.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 virtual bool DeferDraws() OVERRIDE; | 43 virtual bool DeferDraws() OVERRIDE; |
44 virtual bool IsOffscreen() OVERRIDE; | 44 virtual bool IsOffscreen() OVERRIDE; |
45 virtual bool SwapBuffers() OVERRIDE; | 45 virtual bool SwapBuffers() OVERRIDE; |
46 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 46 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
47 virtual std::string GetExtensions() OVERRIDE; | 47 virtual std::string GetExtensions() OVERRIDE; |
48 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; | 48 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; |
49 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 49 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
50 | 50 |
51 protected: | 51 protected: |
52 // ImageTransportSurface implementation | 52 // ImageTransportSurface implementation |
53 virtual void OnBufferPresented(uint64 surface_handle, | 53 virtual void OnBufferPresented(bool presented, uint32 sync_point) OVERRIDE; |
54 uint32 sync_point) OVERRIDE; | |
55 virtual void OnResizeViewACK() OVERRIDE; | 54 virtual void OnResizeViewACK() OVERRIDE; |
56 virtual void OnResize(gfx::Size size) OVERRIDE; | 55 virtual void OnResize(gfx::Size size) OVERRIDE; |
57 virtual gfx::Size GetSize() OVERRIDE; | 56 virtual gfx::Size GetSize() OVERRIDE; |
58 | 57 |
59 private: | 58 private: |
60 virtual ~PbufferImageTransportSurface(); | 59 virtual ~PbufferImageTransportSurface(); |
61 void SendBuffersSwapped(); | 60 void SendBuffersSwapped(); |
62 void DestroySurface(); | 61 void DestroySurface(); |
63 | 62 |
64 // Tracks the current buffer allocation state. | 63 // Tracks the current buffer allocation state. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 params.surface_handle = reinterpret_cast<int64>(GetShareHandle()); | 199 params.surface_handle = reinterpret_cast<int64>(GetShareHandle()); |
201 CHECK(params.surface_handle); | 200 CHECK(params.surface_handle); |
202 params.size = GetSize(); | 201 params.size = GetSize(); |
203 | 202 |
204 helper_->SendAcceleratedSurfaceBuffersSwapped(params); | 203 helper_->SendAcceleratedSurfaceBuffersSwapped(params); |
205 | 204 |
206 DCHECK(!is_swap_buffers_pending_); | 205 DCHECK(!is_swap_buffers_pending_); |
207 is_swap_buffers_pending_ = true; | 206 is_swap_buffers_pending_ = true; |
208 } | 207 } |
209 | 208 |
210 void PbufferImageTransportSurface::OnBufferPresented(uint64 surface_handle, | 209 void PbufferImageTransportSurface::OnBufferPresented(bool presented, |
211 uint32 sync_point) { | 210 uint32 sync_point) { |
212 is_swap_buffers_pending_ = false; | 211 is_swap_buffers_pending_ = false; |
213 if (did_unschedule_) { | 212 if (did_unschedule_) { |
214 did_unschedule_ = false; | 213 did_unschedule_ = false; |
215 helper_->SetScheduled(true); | 214 helper_->SetScheduled(true); |
216 } | 215 } |
217 } | 216 } |
218 | 217 |
219 void PbufferImageTransportSurface::OnResizeViewACK() { | 218 void PbufferImageTransportSurface::OnResizeViewACK() { |
220 NOTREACHED(); | 219 NOTREACHED(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 283 |
285 if (surface->Initialize()) | 284 if (surface->Initialize()) |
286 return surface; | 285 return surface; |
287 else | 286 else |
288 return NULL; | 287 return NULL; |
289 } | 288 } |
290 | 289 |
291 } // namespace content | 290 } // namespace content |
292 | 291 |
293 #endif // ENABLE_GPU | 292 #endif // ENABLE_GPU |
OLD | NEW |