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 #include "content/renderer/gpu/compositor_output_surface.h" | 5 #include "content/renderer/gpu/compositor_output_surface.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.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" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 output_surface_filter_->AddRoute( | 97 output_surface_filter_->AddRoute( |
98 routing_id_, | 98 routing_id_, |
99 base::Bind(&CompositorOutputSurfaceProxy::OnMessageReceived, | 99 base::Bind(&CompositorOutputSurfaceProxy::OnMessageReceived, |
100 output_surface_proxy_)); | 100 output_surface_proxy_)); |
101 | 101 |
102 if (!context_provider()) { | 102 if (!context_provider()) { |
103 // Without a GPU context, the memory policy otherwise wouldn't be set. | 103 // Without a GPU context, the memory policy otherwise wouldn't be set. |
104 client->SetMemoryPolicy(cc::ManagedMemoryPolicy( | 104 client->SetMemoryPolicy(cc::ManagedMemoryPolicy( |
105 64 * 1024 * 1024, | 105 64 * 1024 * 1024, |
106 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, | 106 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, |
107 0, | |
108 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING, | |
109 cc::ManagedMemoryPolicy::kDefaultNumResourcesLimit)); | 107 cc::ManagedMemoryPolicy::kDefaultNumResourcesLimit)); |
110 } | 108 } |
111 | 109 |
112 return true; | 110 return true; |
113 } | 111 } |
114 | 112 |
115 void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { | 113 void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { |
116 if (use_swap_compositor_frame_message_) { | 114 if (use_swap_compositor_frame_message_) { |
117 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, | 115 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, |
118 output_surface_id_, | 116 output_surface_id_, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // If this is the last surface to stop preferring smoothness, | 226 // If this is the last surface to stop preferring smoothness, |
229 // Reset the main thread's priority to the default. | 227 // Reset the main thread's priority to the default. |
230 if (prefers_smoothness_ == true && | 228 if (prefers_smoothness_ == true && |
231 --g_prefer_smoothness_count == 0) { | 229 --g_prefer_smoothness_count == 0) { |
232 SetThreadPriorityToDefault(main_thread_handle_); | 230 SetThreadPriorityToDefault(main_thread_handle_); |
233 } | 231 } |
234 prefers_smoothness_ = prefers_smoothness; | 232 prefers_smoothness_ = prefers_smoothness; |
235 } | 233 } |
236 | 234 |
237 } // namespace content | 235 } // namespace content |
OLD | NEW |