| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/android/in_process/synchronous_compositor_impl.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 contents_->GetRenderWidgetHostView()); | 209 contents_->GetRenderWidgetHostView()); |
| 210 if (rwhv) | 210 if (rwhv) |
| 211 rwhv->SynchronousFrameMetadata(frame_metadata); | 211 rwhv->SynchronousFrameMetadata(frame_metadata); |
| 212 DeliverMessages(); | 212 DeliverMessages(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void SynchronousCompositorImpl::SetMemoryPolicy(size_t bytes_limit) { | 215 void SynchronousCompositorImpl::SetMemoryPolicy(size_t bytes_limit) { |
| 216 DCHECK(CalledOnValidThread()); | 216 DCHECK(CalledOnValidThread()); |
| 217 DCHECK(output_surface_); | 217 DCHECK(output_surface_); |
| 218 | 218 |
| 219 size_t current_bytes_limit = output_surface_->GetMemoryPolicy(); |
| 219 output_surface_->SetMemoryPolicy(bytes_limit); | 220 output_surface_->SetMemoryPolicy(bytes_limit); |
| 221 |
| 222 if (bytes_limit && !current_bytes_limit) { |
| 223 g_factory.Get().CompositorInitializedHardwareDraw(); |
| 224 } else if (!bytes_limit && current_bytes_limit) { |
| 225 g_factory.Get().CompositorReleasedHardwareDraw(); |
| 226 } |
| 220 } | 227 } |
| 221 | 228 |
| 222 void SynchronousCompositorImpl::PostInvalidate() { | 229 void SynchronousCompositorImpl::PostInvalidate() { |
| 223 DCHECK(CalledOnValidThread()); | 230 DCHECK(CalledOnValidThread()); |
| 224 DCHECK(compositor_client_); | 231 DCHECK(compositor_client_); |
| 225 compositor_client_->PostInvalidate(); | 232 compositor_client_->PostInvalidate(); |
| 226 } | 233 } |
| 227 | 234 |
| 228 void SynchronousCompositorImpl::DidChangeRootLayerScrollOffset() { | 235 void SynchronousCompositorImpl::DidChangeRootLayerScrollOffset() { |
| 229 if (input_handler_) | 236 if (input_handler_) |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 g_factory.Get(); // Ensure it's initialized. | 368 g_factory.Get(); // Ensure it's initialized. |
| 362 SynchronousCompositorImpl::CreateForWebContents(contents); | 369 SynchronousCompositorImpl::CreateForWebContents(contents); |
| 363 } | 370 } |
| 364 SynchronousCompositorImpl* instance = | 371 SynchronousCompositorImpl* instance = |
| 365 SynchronousCompositorImpl::FromWebContents(contents); | 372 SynchronousCompositorImpl::FromWebContents(contents); |
| 366 DCHECK(instance); | 373 DCHECK(instance); |
| 367 instance->SetClient(client); | 374 instance->SetClient(client); |
| 368 } | 375 } |
| 369 | 376 |
| 370 } // namespace content | 377 } // namespace content |
| OLD | NEW |