| 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 13 matching lines...) Expand all Loading... |
| 24 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
| 25 #include "ui/gfx/size.h" | 25 #include "ui/gfx/size.h" |
| 26 | 26 |
| 27 using std::set; | 27 using std::set; |
| 28 using std::string; | 28 using std::string; |
| 29 using std::vector; | 29 using std::vector; |
| 30 | 30 |
| 31 namespace cc { | 31 namespace cc { |
| 32 | 32 |
| 33 OutputSurface::OutputSurface( | 33 OutputSurface::OutputSurface( |
| 34 scoped_refptr<ContextProvider> context_provider) | 34 scoped_refptr<ContextProvider> context_provider, |
| 35 size_t max_transfer_buffer_usage_bytes) |
| 35 : context_provider_(context_provider), | 36 : context_provider_(context_provider), |
| 36 has_gl_discard_backbuffer_(false), | 37 has_gl_discard_backbuffer_(false), |
| 37 has_swap_buffers_complete_callback_(false), | 38 has_swap_buffers_complete_callback_(false), |
| 38 device_scale_factor_(-1), | 39 device_scale_factor_(-1), |
| 39 weak_ptr_factory_(this), | 40 weak_ptr_factory_(this), |
| 40 max_frames_pending_(0), | 41 max_frames_pending_(0), |
| 41 pending_swap_buffers_(0), | 42 pending_swap_buffers_(0), |
| 42 needs_begin_frame_(false), | 43 needs_begin_frame_(false), |
| 43 begin_frame_pending_(false), | 44 begin_frame_pending_(false), |
| 44 client_(NULL), | 45 client_(NULL), |
| 45 check_for_retroactive_begin_frame_pending_(false) { | 46 check_for_retroactive_begin_frame_pending_(false) { |
| 47 capabilities_.max_transfer_buffer_usage_bytes = |
| 48 max_transfer_buffer_usage_bytes; |
| 46 } | 49 } |
| 47 | 50 |
| 48 OutputSurface::OutputSurface( | 51 OutputSurface::OutputSurface( |
| 49 scoped_ptr<cc::SoftwareOutputDevice> software_device) | 52 scoped_ptr<cc::SoftwareOutputDevice> software_device, |
| 53 size_t max_transfer_buffer_usage_bytes) |
| 50 : software_device_(software_device.Pass()), | 54 : software_device_(software_device.Pass()), |
| 51 has_gl_discard_backbuffer_(false), | 55 has_gl_discard_backbuffer_(false), |
| 52 has_swap_buffers_complete_callback_(false), | 56 has_swap_buffers_complete_callback_(false), |
| 53 device_scale_factor_(-1), | 57 device_scale_factor_(-1), |
| 54 weak_ptr_factory_(this), | 58 weak_ptr_factory_(this), |
| 55 max_frames_pending_(0), | 59 max_frames_pending_(0), |
| 56 pending_swap_buffers_(0), | 60 pending_swap_buffers_(0), |
| 57 needs_begin_frame_(false), | 61 needs_begin_frame_(false), |
| 58 begin_frame_pending_(false), | 62 begin_frame_pending_(false), |
| 59 client_(NULL), | 63 client_(NULL), |
| 60 check_for_retroactive_begin_frame_pending_(false) { | 64 check_for_retroactive_begin_frame_pending_(false) { |
| 65 capabilities_.max_transfer_buffer_usage_bytes = |
| 66 max_transfer_buffer_usage_bytes; |
| 61 } | 67 } |
| 62 | 68 |
| 63 OutputSurface::OutputSurface( | 69 OutputSurface::OutputSurface( |
| 64 scoped_refptr<ContextProvider> context_provider, | 70 scoped_refptr<ContextProvider> context_provider, |
| 65 scoped_ptr<cc::SoftwareOutputDevice> software_device) | 71 scoped_ptr<cc::SoftwareOutputDevice> software_device, |
| 72 size_t max_transfer_buffer_usage_bytes) |
| 66 : context_provider_(context_provider), | 73 : context_provider_(context_provider), |
| 67 software_device_(software_device.Pass()), | 74 software_device_(software_device.Pass()), |
| 68 has_gl_discard_backbuffer_(false), | 75 has_gl_discard_backbuffer_(false), |
| 69 has_swap_buffers_complete_callback_(false), | 76 has_swap_buffers_complete_callback_(false), |
| 70 device_scale_factor_(-1), | 77 device_scale_factor_(-1), |
| 71 weak_ptr_factory_(this), | 78 weak_ptr_factory_(this), |
| 72 max_frames_pending_(0), | 79 max_frames_pending_(0), |
| 73 pending_swap_buffers_(0), | 80 pending_swap_buffers_(0), |
| 74 needs_begin_frame_(false), | 81 needs_begin_frame_(false), |
| 75 begin_frame_pending_(false), | 82 begin_frame_pending_(false), |
| 76 client_(NULL), | 83 client_(NULL), |
| 77 check_for_retroactive_begin_frame_pending_(false) { | 84 check_for_retroactive_begin_frame_pending_(false) { |
| 85 capabilities_.max_transfer_buffer_usage_bytes = |
| 86 max_transfer_buffer_usage_bytes; |
| 78 } | 87 } |
| 79 | 88 |
| 80 void OutputSurface::InitializeBeginFrameEmulation( | 89 void OutputSurface::InitializeBeginFrameEmulation( |
| 81 base::SingleThreadTaskRunner* task_runner, | 90 base::SingleThreadTaskRunner* task_runner, |
| 82 bool throttle_frame_production, | 91 bool throttle_frame_production, |
| 83 base::TimeDelta interval) { | 92 base::TimeDelta interval) { |
| 84 if (throttle_frame_production) { | 93 if (throttle_frame_production) { |
| 85 frame_rate_controller_.reset( | 94 frame_rate_controller_.reset( |
| 86 new FrameRateController( | 95 new FrameRateController( |
| 87 DelayBasedTimeSource::Create(interval, task_runner))); | 96 DelayBasedTimeSource::Create(interval, task_runner))); |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 "bytes_limit_when_visible", policy.bytes_limit_when_visible, | 409 "bytes_limit_when_visible", policy.bytes_limit_when_visible, |
| 401 "discard_backbuffer", discard_backbuffer); | 410 "discard_backbuffer", discard_backbuffer); |
| 402 // Just ignore the memory manager when it says to set the limit to zero | 411 // Just ignore the memory manager when it says to set the limit to zero |
| 403 // bytes. This will happen when the memory manager thinks that the renderer | 412 // bytes. This will happen when the memory manager thinks that the renderer |
| 404 // is not visible (which the renderer knows better). | 413 // is not visible (which the renderer knows better). |
| 405 if (policy.bytes_limit_when_visible) | 414 if (policy.bytes_limit_when_visible) |
| 406 client_->SetMemoryPolicy(policy); | 415 client_->SetMemoryPolicy(policy); |
| 407 client_->SetDiscardBackBufferWhenNotVisible(discard_backbuffer); | 416 client_->SetDiscardBackBufferWhenNotVisible(discard_backbuffer); |
| 408 } | 417 } |
| 409 | 418 |
| 419 const size_t OutputSurface::kDefaultMaxTransferBufferUsageBytes = |
| 420 std::numeric_limits<size_t>::max(); |
| 421 |
| 410 } // namespace cc | 422 } // namespace cc |
| OLD | NEW |