| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 void SynchronousCompositorImpl::UpdateFrameMetaData( | 207 void SynchronousCompositorImpl::UpdateFrameMetaData( |
| 208 const cc::CompositorFrameMetadata& frame_metadata) { | 208 const cc::CompositorFrameMetadata& frame_metadata) { |
| 209 rwhva_->SynchronousFrameMetadata(frame_metadata); | 209 rwhva_->SynchronousFrameMetadata(frame_metadata); |
| 210 DeliverMessages(); | 210 DeliverMessages(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void SynchronousCompositorImpl::SetMemoryPolicy(size_t bytes_limit) { | 213 void SynchronousCompositorImpl::SetMemoryPolicy(size_t bytes_limit) { |
| 214 DCHECK(CalledOnValidThread()); | 214 DCHECK(CalledOnValidThread()); |
| 215 DCHECK(output_surface_); | 215 DCHECK(output_surface_); |
| 216 | |
| 217 size_t current_bytes_limit = output_surface_->GetMemoryPolicy(); | |
| 218 output_surface_->SetMemoryPolicy(bytes_limit); | 216 output_surface_->SetMemoryPolicy(bytes_limit); |
| 219 | |
| 220 if (bytes_limit && !current_bytes_limit) { | |
| 221 SynchronousCompositorStreamTextureFactoryImpl::GetInstance() | |
| 222 ->CompositorInitializedHardwareDraw(); | |
| 223 } else if (!bytes_limit && current_bytes_limit) { | |
| 224 SynchronousCompositorStreamTextureFactoryImpl::GetInstance() | |
| 225 ->CompositorReleasedHardwareDraw(); | |
| 226 } | |
| 227 } | 217 } |
| 228 | 218 |
| 229 void SynchronousCompositorImpl::Invalidate() { | 219 void SynchronousCompositorImpl::Invalidate() { |
| 230 DCHECK(CalledOnValidThread()); | 220 DCHECK(CalledOnValidThread()); |
| 231 if (registered_with_client_) | 221 if (registered_with_client_) |
| 232 compositor_client_->PostInvalidate(); | 222 compositor_client_->PostInvalidate(); |
| 233 } | 223 } |
| 234 | 224 |
| 235 void SynchronousCompositorImpl::DidChangeRootLayerScrollOffset( | 225 void SynchronousCompositorImpl::DidChangeRootLayerScrollOffset( |
| 236 const gfx::ScrollOffset& root_offset) { | 226 const gfx::ScrollOffset& root_offset) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 } | 367 } |
| 378 } | 368 } |
| 379 | 369 |
| 380 // Not using base::NonThreadSafe as we want to enforce a more exacting threading | 370 // Not using base::NonThreadSafe as we want to enforce a more exacting threading |
| 381 // requirement: SynchronousCompositorImpl() must only be used on the UI thread. | 371 // requirement: SynchronousCompositorImpl() must only be used on the UI thread. |
| 382 bool SynchronousCompositorImpl::CalledOnValidThread() const { | 372 bool SynchronousCompositorImpl::CalledOnValidThread() const { |
| 383 return BrowserThread::CurrentlyOn(BrowserThread::UI); | 373 return BrowserThread::CurrentlyOn(BrowserThread::UI); |
| 384 } | 374 } |
| 385 | 375 |
| 386 } // namespace content | 376 } // namespace content |
| OLD | NEW |