| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/compositor/test/in_process_context_factory.h" | 5 #include "ui/compositor/test/in_process_context_factory.h" | 
| 6 | 6 | 
| 7 #include "base/bind.h" | 7 #include "base/bind.h" | 
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" | 
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" | 
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 55   } | 55   } | 
| 56 | 56 | 
| 57  private: | 57  private: | 
| 58   base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_; | 58   base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_; | 
| 59 | 59 | 
| 60   DISALLOW_COPY_AND_ASSIGN(DirectOutputSurface); | 60   DISALLOW_COPY_AND_ASSIGN(DirectOutputSurface); | 
| 61 }; | 61 }; | 
| 62 | 62 | 
| 63 }  // namespace | 63 }  // namespace | 
| 64 | 64 | 
| 65 InProcessContextFactory::InProcessContextFactory() | 65 InProcessContextFactory::InProcessContextFactory(bool context_factory_for_test) | 
| 66     : next_surface_id_namespace_(1u), use_test_surface_(true) { | 66     : next_surface_id_namespace_(1u), | 
|  | 67       use_test_surface_(true), | 
|  | 68       context_factory_for_test_(context_factory_for_test) { | 
| 67   DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) | 69   DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) | 
| 68       << "If running tests, ensure that main() is calling " | 70       << "If running tests, ensure that main() is calling " | 
| 69       << "gfx::GLSurface::InitializeOneOffForTests()"; | 71       << "gfx::GLSurface::InitializeOneOffForTests()"; | 
| 70 | 72 | 
| 71 #if defined(OS_CHROMEOS) | 73 #if defined(OS_CHROMEOS) | 
| 72   bool use_thread = !base::CommandLine::ForCurrentProcess()->HasSwitch( | 74   bool use_thread = !base::CommandLine::ForCurrentProcess()->HasSwitch( | 
| 73       switches::kUIDisableThreadedCompositing); | 75       switches::kUIDisableThreadedCompositing); | 
| 74 #else | 76 #else | 
| 75   bool use_thread = false; | 77   bool use_thread = false; | 
| 76 #endif | 78 #endif | 
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 133       lose_context_when_out_of_memory); | 135       lose_context_when_out_of_memory); | 
| 134   if (shared_main_thread_contexts_.get() && | 136   if (shared_main_thread_contexts_.get() && | 
| 135       !shared_main_thread_contexts_->BindToCurrentThread()) | 137       !shared_main_thread_contexts_->BindToCurrentThread()) | 
| 136     shared_main_thread_contexts_ = NULL; | 138     shared_main_thread_contexts_ = NULL; | 
| 137 | 139 | 
| 138   return shared_main_thread_contexts_; | 140   return shared_main_thread_contexts_; | 
| 139 } | 141 } | 
| 140 | 142 | 
| 141 void InProcessContextFactory::RemoveCompositor(Compositor* compositor) {} | 143 void InProcessContextFactory::RemoveCompositor(Compositor* compositor) {} | 
| 142 | 144 | 
| 143 bool InProcessContextFactory::DoesCreateTestContexts() { return false; } | 145 bool InProcessContextFactory::DoesCreateTestContexts() { | 
|  | 146   return context_factory_for_test_; | 
|  | 147 } | 
| 144 | 148 | 
| 145 cc::SharedBitmapManager* InProcessContextFactory::GetSharedBitmapManager() { | 149 cc::SharedBitmapManager* InProcessContextFactory::GetSharedBitmapManager() { | 
| 146   return &shared_bitmap_manager_; | 150   return &shared_bitmap_manager_; | 
| 147 } | 151 } | 
| 148 | 152 | 
| 149 gpu::GpuMemoryBufferManager* | 153 gpu::GpuMemoryBufferManager* | 
| 150 InProcessContextFactory::GetGpuMemoryBufferManager() { | 154 InProcessContextFactory::GetGpuMemoryBufferManager() { | 
| 151   return &gpu_memory_buffer_manager_; | 155   return &gpu_memory_buffer_manager_; | 
| 152 } | 156 } | 
| 153 | 157 | 
| 154 base::MessageLoopProxy* InProcessContextFactory::GetCompositorMessageLoop() { | 158 base::MessageLoopProxy* InProcessContextFactory::GetCompositorMessageLoop() { | 
| 155   if (!compositor_thread_) | 159   if (!compositor_thread_) | 
| 156     return NULL; | 160     return NULL; | 
| 157   return compositor_thread_->message_loop_proxy().get(); | 161   return compositor_thread_->message_loop_proxy().get(); | 
| 158 } | 162 } | 
| 159 | 163 | 
| 160 scoped_ptr<cc::SurfaceIdAllocator> | 164 scoped_ptr<cc::SurfaceIdAllocator> | 
| 161 InProcessContextFactory::CreateSurfaceIdAllocator() { | 165 InProcessContextFactory::CreateSurfaceIdAllocator() { | 
| 162   return make_scoped_ptr( | 166   return make_scoped_ptr( | 
| 163       new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); | 167       new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); | 
| 164 } | 168 } | 
| 165 | 169 | 
| 166 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, | 170 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, | 
| 167                                             const gfx::Size& size) { | 171                                             const gfx::Size& size) { | 
| 168 } | 172 } | 
| 169 | 173 | 
| 170 }  // namespace ui | 174 }  // namespace ui | 
| OLD | NEW | 
|---|