| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "cc/output/output_surface.h" | 5 #include "cc/output/output_surface.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 begin_frame_pending_(false), | 58 begin_frame_pending_(false), |
| 59 client_(NULL), | 59 client_(NULL), |
| 60 check_for_retroactive_begin_frame_pending_(false) { | 60 check_for_retroactive_begin_frame_pending_(false) { |
| 61 } | 61 } |
| 62 | 62 |
| 63 OutputSurface::OutputSurface( | 63 OutputSurface::OutputSurface( |
| 64 scoped_refptr<ContextProvider> context_provider, | 64 scoped_refptr<ContextProvider> context_provider, |
| 65 scoped_ptr<cc::SoftwareOutputDevice> software_device) | 65 scoped_ptr<cc::SoftwareOutputDevice> software_device) |
| 66 : context_provider_(context_provider), | 66 : context_provider_(context_provider), |
| 67 software_device_(software_device.Pass()), | 67 software_device_(software_device.Pass()), |
| 68 context_is_lost_(false), |
| 68 has_gl_discard_backbuffer_(false), | 69 has_gl_discard_backbuffer_(false), |
| 69 has_swap_buffers_complete_callback_(false), | 70 has_swap_buffers_complete_callback_(false), |
| 70 device_scale_factor_(-1), | 71 device_scale_factor_(-1), |
| 71 weak_ptr_factory_(this), | 72 weak_ptr_factory_(this), |
| 72 max_frames_pending_(0), | 73 max_frames_pending_(0), |
| 73 pending_swap_buffers_(0), | 74 pending_swap_buffers_(0), |
| 74 needs_begin_frame_(false), | 75 needs_begin_frame_(false), |
| 75 begin_frame_pending_(false), | 76 begin_frame_pending_(false), |
| 76 client_(NULL), | 77 client_(NULL), |
| 77 check_for_retroactive_begin_frame_pending_(false) { | 78 check_for_retroactive_begin_frame_pending_(false) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 client_->OnSwapBuffersComplete(ack); | 210 client_->OnSwapBuffersComplete(ack); |
| 210 if (frame_rate_controller_) | 211 if (frame_rate_controller_) |
| 211 frame_rate_controller_->DidSwapBuffersComplete(); | 212 frame_rate_controller_->DidSwapBuffersComplete(); |
| 212 PostCheckForRetroactiveBeginFrame(); | 213 PostCheckForRetroactiveBeginFrame(); |
| 213 } | 214 } |
| 214 | 215 |
| 215 void OutputSurface::DidLoseOutputSurface() { | 216 void OutputSurface::DidLoseOutputSurface() { |
| 216 TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface"); | 217 TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface"); |
| 217 begin_frame_pending_ = false; | 218 begin_frame_pending_ = false; |
| 218 pending_swap_buffers_ = 0; | 219 pending_swap_buffers_ = 0; |
| 220 context_is_lost_ = true; |
| 219 client_->DidLoseOutputSurface(); | 221 client_->DidLoseOutputSurface(); |
| 220 } | 222 } |
| 221 | 223 |
| 222 void OutputSurface::SetExternalStencilTest(bool enabled) { | 224 void OutputSurface::SetExternalStencilTest(bool enabled) { |
| 223 client_->SetExternalStencilTest(enabled); | 225 client_->SetExternalStencilTest(enabled); |
| 224 } | 226 } |
| 225 | 227 |
| 226 void OutputSurface::SetExternalDrawConstraints(const gfx::Transform& transform, | 228 void OutputSurface::SetExternalDrawConstraints(const gfx::Transform& transform, |
| 227 gfx::Rect viewport, | 229 gfx::Rect viewport, |
| 228 gfx::Rect clip, | 230 gfx::Rect clip, |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 "discard_backbuffer", discard_backbuffer); | 400 "discard_backbuffer", discard_backbuffer); |
| 399 // Just ignore the memory manager when it says to set the limit to zero | 401 // Just ignore the memory manager when it says to set the limit to zero |
| 400 // bytes. This will happen when the memory manager thinks that the renderer | 402 // bytes. This will happen when the memory manager thinks that the renderer |
| 401 // is not visible (which the renderer knows better). | 403 // is not visible (which the renderer knows better). |
| 402 if (policy.bytes_limit_when_visible) | 404 if (policy.bytes_limit_when_visible) |
| 403 client_->SetMemoryPolicy(policy); | 405 client_->SetMemoryPolicy(policy); |
| 404 client_->SetDiscardBackBufferWhenNotVisible(discard_backbuffer); | 406 client_->SetDiscardBackBufferWhenNotVisible(discard_backbuffer); |
| 405 } | 407 } |
| 406 | 408 |
| 407 } // namespace cc | 409 } // namespace cc |
| OLD | NEW |