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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 | 102 |
103 output_surface_proxy_ = new CompositorOutputSurfaceProxy(this); | 103 output_surface_proxy_ = new CompositorOutputSurfaceProxy(this); |
104 output_surface_filter_->AddRoute( | 104 output_surface_filter_->AddRoute( |
105 routing_id_, | 105 routing_id_, |
106 base::Bind(&CompositorOutputSurfaceProxy::OnMessageReceived, | 106 base::Bind(&CompositorOutputSurfaceProxy::OnMessageReceived, |
107 output_surface_proxy_)); | 107 output_surface_proxy_)); |
108 | 108 |
109 if (!context_provider()) { | 109 if (!context_provider()) { |
110 // Without a GPU context, the memory policy otherwise wouldn't be set. | 110 // Without a GPU context, the memory policy otherwise wouldn't be set. |
111 client->SetMemoryPolicy(cc::ManagedMemoryPolicy( | 111 client->SetMemoryPolicy(cc::ManagedMemoryPolicy( |
112 128 * 1024 * 1024, | 112 128 * 1024 * 1024, gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE)); |
113 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, | |
114 base::SharedMemory::GetHandleLimit() / 3)); | |
boliu
2014/10/28 00:19:54
Hmm, this kinda assumes there's at most 3 composit
| |
115 } | 113 } |
116 | 114 |
117 return true; | 115 return true; |
118 } | 116 } |
119 | 117 |
120 void CompositorOutputSurface::ShortcutSwapAck( | 118 void CompositorOutputSurface::ShortcutSwapAck( |
121 uint32 output_surface_id, | 119 uint32 output_surface_id, |
122 scoped_ptr<cc::GLFrameData> gl_frame_data, | 120 scoped_ptr<cc::GLFrameData> gl_frame_data, |
123 scoped_ptr<cc::SoftwareFrameData> software_frame_data) { | 121 scoped_ptr<cc::SoftwareFrameData> software_frame_data) { |
124 if (!layout_test_previous_frame_ack_) { | 122 if (!layout_test_previous_frame_ack_) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 // If this is the last surface to stop preferring smoothness, | 275 // If this is the last surface to stop preferring smoothness, |
278 // Reset the main thread's priority to the default. | 276 // Reset the main thread's priority to the default. |
279 if (prefers_smoothness_ == true && | 277 if (prefers_smoothness_ == true && |
280 --g_prefer_smoothness_count == 0) { | 278 --g_prefer_smoothness_count == 0) { |
281 SetThreadPriorityToDefault(main_thread_handle_); | 279 SetThreadPriorityToDefault(main_thread_handle_); |
282 } | 280 } |
283 prefers_smoothness_ = prefers_smoothness; | 281 prefers_smoothness_ = prefers_smoothness; |
284 } | 282 } |
285 | 283 |
286 } // namespace content | 284 } // namespace content |
OLD | NEW |