| 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 27 matching lines...) Expand all Loading... |
| 38 it.Advance(); | 38 it.Advance(); |
| 39 DCHECK(it.IsAtEnd()); // Not multiprocess compatible. | 39 DCHECK(it.IsAtEnd()); // Not multiprocess compatible. |
| 40 return id; | 40 return id; |
| 41 } | 41 } |
| 42 | 42 |
| 43 base::LazyInstance<SynchronousCompositorFactoryImpl>::Leaky g_factory = | 43 base::LazyInstance<SynchronousCompositorFactoryImpl>::Leaky g_factory = |
| 44 LAZY_INSTANCE_INITIALIZER; | 44 LAZY_INSTANCE_INITIALIZER; |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 | 47 |
| 48 SynchronousCompositor::ContextHolder::ContextHolder() : context(nullptr) { |
| 49 } |
| 50 |
| 51 SynchronousCompositor::ContextHolder::~ContextHolder() { |
| 52 } |
| 53 |
| 48 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SynchronousCompositorImpl); | 54 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SynchronousCompositorImpl); |
| 49 | 55 |
| 50 // static | 56 // static |
| 51 SynchronousCompositorImpl* SynchronousCompositorImpl::FromID(int process_id, | 57 SynchronousCompositorImpl* SynchronousCompositorImpl::FromID(int process_id, |
| 52 int routing_id) { | 58 int routing_id) { |
| 53 if (g_factory == NULL) | 59 if (g_factory == NULL) |
| 54 return NULL; | 60 return NULL; |
| 55 RenderViewHost* rvh = RenderViewHost::FromID(process_id, routing_id); | 61 RenderViewHost* rvh = RenderViewHost::FromID(process_id, routing_id); |
| 56 if (!rvh) | 62 if (!rvh) |
| 57 return NULL; | 63 return NULL; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 DCHECK(!begin_frame_source_); | 96 DCHECK(!begin_frame_source_); |
| 91 } | 97 } |
| 92 | 98 |
| 93 void SynchronousCompositorImpl::SetClient( | 99 void SynchronousCompositorImpl::SetClient( |
| 94 SynchronousCompositorClient* compositor_client) { | 100 SynchronousCompositorClient* compositor_client) { |
| 95 DCHECK(CalledOnValidThread()); | 101 DCHECK(CalledOnValidThread()); |
| 96 compositor_client_ = compositor_client; | 102 compositor_client_ = compositor_client; |
| 97 } | 103 } |
| 98 | 104 |
| 99 // static | 105 // static |
| 106 void SynchronousCompositor::SetCreateContextCallback( |
| 107 CreateContextCallback callback) { |
| 108 } |
| 109 |
| 110 // static |
| 100 void SynchronousCompositor::SetGpuService( | 111 void SynchronousCompositor::SetGpuService( |
| 101 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { | 112 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { |
| 102 g_factory.Get().SetDeferredGpuService(service); | 113 g_factory.Get().SetDeferredGpuService(service); |
| 103 } | 114 } |
| 104 | 115 |
| 105 // static | 116 // static |
| 106 void SynchronousCompositor::SetRecordFullDocument(bool record_full_document) { | 117 void SynchronousCompositor::SetRecordFullDocument(bool record_full_document) { |
| 107 g_factory.Get().SetRecordFullDocument(record_full_document); | 118 g_factory.Get().SetRecordFullDocument(record_full_document); |
| 108 } | 119 } |
| 109 | 120 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 g_factory.Get(); // Ensure it's initialized. | 379 g_factory.Get(); // Ensure it's initialized. |
| 369 SynchronousCompositorImpl::CreateForWebContents(contents); | 380 SynchronousCompositorImpl::CreateForWebContents(contents); |
| 370 } | 381 } |
| 371 SynchronousCompositorImpl* instance = | 382 SynchronousCompositorImpl* instance = |
| 372 SynchronousCompositorImpl::FromWebContents(contents); | 383 SynchronousCompositorImpl::FromWebContents(contents); |
| 373 DCHECK(instance); | 384 DCHECK(instance); |
| 374 instance->SetClient(client); | 385 instance->SetClient(client); |
| 375 } | 386 } |
| 376 | 387 |
| 377 } // namespace content | 388 } // namespace content |
| OLD | NEW |