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/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/compositor_frame_ack.h" | 10 #include "cc/output/compositor_frame_ack.h" |
11 #include "cc/output/direct_renderer.h" | 11 #include "cc/output/direct_renderer.h" |
12 #include "cc/output/gl_renderer.h" | 12 #include "cc/output/gl_renderer.h" |
13 #include "cc/output/software_renderer.h" | 13 #include "cc/output/software_renderer.h" |
| 14 #include "cc/resources/texture_mailbox_deleter.h" |
14 #include "cc/surfaces/display_client.h" | 15 #include "cc/surfaces/display_client.h" |
15 #include "cc/surfaces/surface.h" | 16 #include "cc/surfaces/surface.h" |
16 #include "cc/surfaces/surface_aggregator.h" | 17 #include "cc/surfaces/surface_aggregator.h" |
17 #include "cc/surfaces/surface_manager.h" | 18 #include "cc/surfaces/surface_manager.h" |
18 #include "cc/trees/blocking_task_runner.h" | 19 #include "cc/trees/blocking_task_runner.h" |
19 | 20 |
20 namespace cc { | 21 namespace cc { |
21 | 22 |
22 Display::Display(DisplayClient* client, | 23 Display::Display(DisplayClient* client, |
23 SurfaceManager* manager, | 24 SurfaceManager* manager, |
24 SharedBitmapManager* bitmap_manager) | 25 SharedBitmapManager* bitmap_manager) |
25 : client_(client), | 26 : client_(client), |
26 manager_(manager), | 27 manager_(manager), |
27 bitmap_manager_(bitmap_manager), | 28 bitmap_manager_(bitmap_manager), |
28 blocking_main_thread_task_runner_( | 29 blocking_main_thread_task_runner_( |
29 BlockingTaskRunner::Create(base::MessageLoopProxy::current())) { | 30 BlockingTaskRunner::Create(base::MessageLoopProxy::current())), |
| 31 texture_mailbox_deleter_( |
| 32 new TextureMailboxDeleter(base::MessageLoopProxy::current())) { |
30 manager_->AddObserver(this); | 33 manager_->AddObserver(this); |
31 } | 34 } |
32 | 35 |
33 Display::~Display() { | 36 Display::~Display() { |
34 manager_->RemoveObserver(this); | 37 manager_->RemoveObserver(this); |
35 } | 38 } |
36 | 39 |
37 void Display::Resize(SurfaceId id, const gfx::Size& size) { | 40 void Display::Resize(SurfaceId id, const gfx::Size& size) { |
38 current_surface_id_ = id; | 41 current_surface_id_ = id; |
39 current_surface_size_ = size; | 42 current_surface_size_ = size; |
(...skipping 16 matching lines...) Expand all Loading... |
56 bitmap_manager_, | 59 bitmap_manager_, |
57 blocking_main_thread_task_runner_.get(), | 60 blocking_main_thread_task_runner_.get(), |
58 highp_threshold_min, | 61 highp_threshold_min, |
59 use_rgba_4444_texture_format, | 62 use_rgba_4444_texture_format, |
60 id_allocation_chunk_size, | 63 id_allocation_chunk_size, |
61 use_distance_field_text); | 64 use_distance_field_text); |
62 if (!resource_provider) | 65 if (!resource_provider) |
63 return; | 66 return; |
64 | 67 |
65 if (output_surface->context_provider()) { | 68 if (output_surface->context_provider()) { |
66 TextureMailboxDeleter* texture_mailbox_deleter = NULL; | |
67 scoped_ptr<GLRenderer> renderer = | 69 scoped_ptr<GLRenderer> renderer = |
68 GLRenderer::Create(this, | 70 GLRenderer::Create(this, |
69 &settings_, | 71 &settings_, |
70 output_surface.get(), | 72 output_surface.get(), |
71 resource_provider.get(), | 73 resource_provider.get(), |
72 texture_mailbox_deleter, | 74 texture_mailbox_deleter_.get(), |
73 highp_threshold_min); | 75 highp_threshold_min); |
74 if (!renderer) | 76 if (!renderer) |
75 return; | 77 return; |
76 renderer_ = renderer.Pass(); | 78 renderer_ = renderer.Pass(); |
77 } else { | 79 } else { |
78 scoped_ptr<SoftwareRenderer> renderer = SoftwareRenderer::Create( | 80 scoped_ptr<SoftwareRenderer> renderer = SoftwareRenderer::Create( |
79 this, &settings_, output_surface.get(), resource_provider.get()); | 81 this, &settings_, output_surface.get(), resource_provider.get()); |
80 if (!renderer) | 82 if (!renderer) |
81 return; | 83 return; |
82 renderer_ = renderer.Pass(); | 84 renderer_ = renderer.Pass(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 void Display::OnSurfaceDamaged(SurfaceId surface) { | 137 void Display::OnSurfaceDamaged(SurfaceId surface) { |
136 if (aggregator_ && aggregator_->previous_contained_surfaces().count(surface)) | 138 if (aggregator_ && aggregator_->previous_contained_surfaces().count(surface)) |
137 client_->DisplayDamaged(); | 139 client_->DisplayDamaged(); |
138 } | 140 } |
139 | 141 |
140 SurfaceId Display::CurrentSurfaceId() { | 142 SurfaceId Display::CurrentSurfaceId() { |
141 return current_surface_id_; | 143 return current_surface_id_; |
142 } | 144 } |
143 | 145 |
144 } // namespace cc | 146 } // namespace cc |
OLD | NEW |