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 // Detach from thread to allow context to be destroyed on a different | |
124 // thread without being used. | |
125 worker_context_provider->DetachFromThread(); | |
126 } | |
127 | 118 |
128 scoped_ptr<cc::OutputSurface> real_output_surface; | 119 scoped_ptr<cc::OutputSurface> real_output_surface; |
129 | 120 |
130 if (use_test_surface_) { | 121 if (use_test_surface_) { |
131 bool flipped_output_surface = false; | 122 bool flipped_output_surface = false; |
132 real_output_surface = make_scoped_ptr(new cc::PixelTestOutputSurface( | 123 real_output_surface = make_scoped_ptr(new cc::PixelTestOutputSurface( |
133 context_provider, worker_context_provider, flipped_output_surface)); | 124 context_provider, worker_context_provider, flipped_output_surface)); |
134 } else { | 125 } else { |
135 real_output_surface = make_scoped_ptr( | 126 real_output_surface = make_scoped_ptr( |
136 new DirectOutputSurface(context_provider, worker_context_provider)); | 127 new DirectOutputSurface(context_provider, worker_context_provider)); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 212 } |
222 | 213 |
223 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, | 214 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, |
224 const gfx::Size& size) { | 215 const gfx::Size& size) { |
225 if (!per_compositor_data_.count(compositor)) | 216 if (!per_compositor_data_.count(compositor)) |
226 return; | 217 return; |
227 per_compositor_data_[compositor]->display()->Resize(size); | 218 per_compositor_data_[compositor]->display()->Resize(size); |
228 } | 219 } |
229 | 220 |
230 } // namespace ui | 221 } // namespace ui |
OLD | NEW |