| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surfaces/display.h" | 5 #include "cc/surfaces/display.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "cc/debug/benchmark_instrumentation.h" | 9 #include "cc/debug/benchmark_instrumentation.h" |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| 11 #include "cc/output/compositor_frame_ack.h" | 11 #include "cc/output/compositor_frame_ack.h" |
| 12 #include "cc/output/direct_renderer.h" | 12 #include "cc/output/direct_renderer.h" |
| 13 #include "cc/output/gl_renderer.h" | 13 #include "cc/output/gl_renderer.h" |
| 14 #include "cc/output/software_renderer.h" | 14 #include "cc/output/software_renderer.h" |
| 15 #include "cc/resources/texture_mailbox_deleter.h" | 15 #include "cc/resources/texture_mailbox_deleter.h" |
| 16 #include "cc/surfaces/display_client.h" | 16 #include "cc/surfaces/display_client.h" |
| 17 #include "cc/surfaces/surface.h" | 17 #include "cc/surfaces/surface.h" |
| 18 #include "cc/surfaces/surface_aggregator.h" | 18 #include "cc/surfaces/surface_aggregator.h" |
| 19 #include "cc/surfaces/surface_manager.h" | 19 #include "cc/surfaces/surface_manager.h" |
| 20 #include "cc/trees/blocking_task_runner.h" | 20 #include "cc/trees/blocking_task_runner.h" |
| 21 | 21 |
| 22 namespace cc { | 22 namespace cc { |
| 23 | 23 |
| 24 Display::Display(DisplayClient* client, | 24 Display::Display(DisplayClient* client, |
| 25 SurfaceManager* manager, | 25 SurfaceManager* manager, |
| 26 SharedBitmapManager* bitmap_manager) | 26 SharedBitmapManager* bitmap_manager, |
| 27 GpuMemoryBufferManager* gpu_memory_buffer_manager) |
| 27 : client_(client), | 28 : client_(client), |
| 28 manager_(manager), | 29 manager_(manager), |
| 29 bitmap_manager_(bitmap_manager), | 30 bitmap_manager_(bitmap_manager), |
| 31 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
| 30 blocking_main_thread_task_runner_( | 32 blocking_main_thread_task_runner_( |
| 31 BlockingTaskRunner::Create(base::MessageLoopProxy::current())), | 33 BlockingTaskRunner::Create(base::MessageLoopProxy::current())), |
| 32 texture_mailbox_deleter_( | 34 texture_mailbox_deleter_( |
| 33 new TextureMailboxDeleter(base::MessageLoopProxy::current())) { | 35 new TextureMailboxDeleter(base::MessageLoopProxy::current())) { |
| 34 manager_->AddObserver(this); | 36 manager_->AddObserver(this); |
| 35 } | 37 } |
| 36 | 38 |
| 37 Display::~Display() { | 39 Display::~Display() { |
| 38 manager_->RemoveObserver(this); | 40 manager_->RemoveObserver(this); |
| 39 } | 41 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 53 if (resource_provider_) | 55 if (resource_provider_) |
| 54 return; | 56 return; |
| 55 | 57 |
| 56 int highp_threshold_min = 0; | 58 int highp_threshold_min = 0; |
| 57 bool use_rgba_4444_texture_format = false; | 59 bool use_rgba_4444_texture_format = false; |
| 58 size_t id_allocation_chunk_size = 1; | 60 size_t id_allocation_chunk_size = 1; |
| 59 bool use_distance_field_text = false; | 61 bool use_distance_field_text = false; |
| 60 scoped_ptr<ResourceProvider> resource_provider = | 62 scoped_ptr<ResourceProvider> resource_provider = |
| 61 ResourceProvider::Create(output_surface_.get(), | 63 ResourceProvider::Create(output_surface_.get(), |
| 62 bitmap_manager_, | 64 bitmap_manager_, |
| 65 gpu_memory_buffer_manager_, |
| 63 blocking_main_thread_task_runner_.get(), | 66 blocking_main_thread_task_runner_.get(), |
| 64 highp_threshold_min, | 67 highp_threshold_min, |
| 65 use_rgba_4444_texture_format, | 68 use_rgba_4444_texture_format, |
| 66 id_allocation_chunk_size, | 69 id_allocation_chunk_size, |
| 67 use_distance_field_text); | 70 use_distance_field_text); |
| 68 if (!resource_provider) | 71 if (!resource_provider) |
| 69 return; | 72 return; |
| 70 | 73 |
| 71 if (output_surface_->context_provider()) { | 74 if (output_surface_->context_provider()) { |
| 72 scoped_ptr<GLRenderer> renderer = | 75 scoped_ptr<GLRenderer> renderer = |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 return current_surface_id_; | 170 return current_surface_id_; |
| 168 } | 171 } |
| 169 | 172 |
| 170 int Display::GetMaxFramesPending() { | 173 int Display::GetMaxFramesPending() { |
| 171 if (!output_surface_) | 174 if (!output_surface_) |
| 172 return OutputSurface::DEFAULT_MAX_FRAMES_PENDING; | 175 return OutputSurface::DEFAULT_MAX_FRAMES_PENDING; |
| 173 return output_surface_->capabilities().max_frames_pending; | 176 return output_surface_->capabilities().max_frames_pending; |
| 174 } | 177 } |
| 175 | 178 |
| 176 } // namespace cc | 179 } // namespace cc |
| OLD | NEW |