| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 attribs.fail_if_major_perf_caveat = false; | 108 attribs.fail_if_major_perf_caveat = false; |
| 109 attribs.bind_generates_resource = false; | 109 attribs.bind_generates_resource = false; |
| 110 | 110 |
| 111 scoped_refptr<InProcessContextProvider> context_provider = | 111 scoped_refptr<InProcessContextProvider> context_provider = |
| 112 InProcessContextProvider::Create(attribs, &gpu_memory_buffer_manager_, | 112 InProcessContextProvider::Create(attribs, &gpu_memory_buffer_manager_, |
| 113 &image_factory_, | 113 &image_factory_, |
| 114 compositor->widget(), "UICompositor"); | 114 compositor->widget(), "UICompositor"); |
| 115 scoped_refptr<InProcessContextProvider> worker_context_provider = | 115 scoped_refptr<InProcessContextProvider> worker_context_provider = |
| 116 InProcessContextProvider::CreateOffscreen(&gpu_memory_buffer_manager_, | 116 InProcessContextProvider::CreateOffscreen(&gpu_memory_buffer_manager_, |
| 117 &image_factory_); | 117 &image_factory_); |
| 118 if (worker_context_provider && |
| 119 !worker_context_provider->BindToCurrentThread()) |
| 120 worker_context_provider = nullptr; |
| 121 if (worker_context_provider) { |
| 122 worker_context_provider->SetupLock(); |
| 123 worker_context_provider->DetachFromThread(); |
| 124 } |
| 118 | 125 |
| 119 scoped_ptr<cc::OutputSurface> real_output_surface; | 126 scoped_ptr<cc::OutputSurface> real_output_surface; |
| 120 | 127 |
| 121 if (use_test_surface_) { | 128 if (use_test_surface_) { |
| 122 bool flipped_output_surface = false; | 129 bool flipped_output_surface = false; |
| 123 real_output_surface = make_scoped_ptr(new cc::PixelTestOutputSurface( | 130 real_output_surface = make_scoped_ptr(new cc::PixelTestOutputSurface( |
| 124 context_provider, worker_context_provider, flipped_output_surface)); | 131 context_provider, worker_context_provider, flipped_output_surface)); |
| 125 } else { | 132 } else { |
| 126 real_output_surface = make_scoped_ptr( | 133 real_output_surface = make_scoped_ptr( |
| 127 new DirectOutputSurface(context_provider, worker_context_provider)); | 134 new DirectOutputSurface(context_provider, worker_context_provider)); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 } | 219 } |
| 213 | 220 |
| 214 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, | 221 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, |
| 215 const gfx::Size& size) { | 222 const gfx::Size& size) { |
| 216 if (!per_compositor_data_.count(compositor)) | 223 if (!per_compositor_data_.count(compositor)) |
| 217 return; | 224 return; |
| 218 per_compositor_data_[compositor]->display()->Resize(size); | 225 per_compositor_data_[compositor]->display()->Resize(size); |
| 219 } | 226 } |
| 220 | 227 |
| 221 } // namespace ui | 228 } // namespace ui |
| OLD | NEW |