| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 if (!cc::OutputSurface::BindToClient(client)) | 72 if (!cc::OutputSurface::BindToClient(client)) |
| 73 return false; | 73 return false; |
| 74 | 74 |
| 75 output_surface_proxy_ = new CompositorOutputSurfaceProxy(this); | 75 output_surface_proxy_ = new CompositorOutputSurfaceProxy(this); |
| 76 output_surface_filter_handler_ = | 76 output_surface_filter_handler_ = |
| 77 base::Bind(&CompositorOutputSurfaceProxy::OnMessageReceived, | 77 base::Bind(&CompositorOutputSurfaceProxy::OnMessageReceived, |
| 78 output_surface_proxy_); | 78 output_surface_proxy_); |
| 79 output_surface_filter_->AddHandlerOnCompositorThread( | 79 output_surface_filter_->AddHandlerOnCompositorThread( |
| 80 routing_id_, | 80 routing_id_, |
| 81 output_surface_filter_handler_); | 81 output_surface_filter_handler_); |
| 82 | |
| 83 if (!context_provider()) { | |
| 84 // Without a GPU context, the memory policy otherwise wouldn't be set. | |
| 85 client->SetMemoryPolicy(cc::ManagedMemoryPolicy( | |
| 86 128 * 1024 * 1024, | |
| 87 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, | |
| 88 base::SharedMemory::GetHandleLimit() / 3)); | |
| 89 } | |
| 90 | |
| 91 return true; | 82 return true; |
| 92 } | 83 } |
| 93 | 84 |
| 94 void CompositorOutputSurface::DetachFromClient() { | 85 void CompositorOutputSurface::DetachFromClient() { |
| 95 if (!HasClient()) | 86 if (!HasClient()) |
| 96 return; | 87 return; |
| 97 if (output_surface_proxy_) { | 88 if (output_surface_proxy_) { |
| 98 output_surface_proxy_->ClearOutputSurface(); | 89 output_surface_proxy_->ClearOutputSurface(); |
| 99 output_surface_filter_->RemoveHandlerOnCompositorThread( | 90 output_surface_filter_->RemoveHandlerOnCompositorThread( |
| 100 routing_id_, output_surface_filter_handler_); | 91 routing_id_, output_surface_filter_handler_); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 ReclaimResources(resources); | 142 ReclaimResources(resources); |
| 152 if (is_swap_ack) | 143 if (is_swap_ack) |
| 153 client_->DidSwapBuffersComplete(); | 144 client_->DidSwapBuffersComplete(); |
| 154 } | 145 } |
| 155 | 146 |
| 156 bool CompositorOutputSurface::Send(IPC::Message* message) { | 147 bool CompositorOutputSurface::Send(IPC::Message* message) { |
| 157 return message_sender_->Send(message); | 148 return message_sender_->Send(message); |
| 158 } | 149 } |
| 159 | 150 |
| 160 } // namespace content | 151 } // namespace content |
| OLD | NEW |