Chromium Code Reviews| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 #include "gpu/command_buffer/client/context_support.h" | 25 #include "gpu/command_buffer/client/context_support.h" |
| 26 #include "gpu/command_buffer/client/gles2_interface.h" | 26 #include "gpu/command_buffer/client/gles2_interface.h" |
| 27 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 27 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 28 #include "ui/compositor/compositor_switches.h" | 28 #include "ui/compositor/compositor_switches.h" |
| 29 #include "ui/compositor/layer.h" | 29 #include "ui/compositor/layer.h" |
| 30 #include "ui/compositor/reflector.h" | 30 #include "ui/compositor/reflector.h" |
| 31 #include "ui/compositor/test/in_process_context_provider.h" | 31 #include "ui/compositor/test/in_process_context_provider.h" |
| 32 #include "ui/gl/gl_implementation.h" | 32 #include "ui/gl/gl_implementation.h" |
| 33 #include "ui/gl/test/gl_surface_test_support.h" | 33 #include "ui/gl/test/gl_surface_test_support.h" |
| 34 | 34 |
| 35 #if !defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW) | |
| 36 #include "gpu/ipc/common/gpu_surface_tracker.h" | |
| 37 #endif | |
| 38 | |
| 35 namespace ui { | 39 namespace ui { |
| 36 namespace { | 40 namespace { |
| 37 | 41 |
| 38 class FakeReflector : public Reflector { | 42 class FakeReflector : public Reflector { |
| 39 public: | 43 public: |
| 40 FakeReflector() {} | 44 FakeReflector() {} |
| 41 ~FakeReflector() override {} | 45 ~FakeReflector() override {} |
| 42 void OnMirroringCompositorResized() override {} | 46 void OnMirroringCompositorResized() override {} |
| 43 void AddMirroringLayer(Layer* layer) override {} | 47 void AddMirroringLayer(Layer* layer) override {} |
| 44 void RemoveMirroringLayer(Layer* layer) override {} | 48 void RemoveMirroringLayer(Layer* layer) override {} |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 attribs.alpha_size = 8; | 163 attribs.alpha_size = 8; |
| 160 attribs.blue_size = 8; | 164 attribs.blue_size = 8; |
| 161 attribs.green_size = 8; | 165 attribs.green_size = 8; |
| 162 attribs.red_size = 8; | 166 attribs.red_size = 8; |
| 163 attribs.depth_size = 0; | 167 attribs.depth_size = 0; |
| 164 attribs.stencil_size = 0; | 168 attribs.stencil_size = 0; |
| 165 attribs.samples = 0; | 169 attribs.samples = 0; |
| 166 attribs.sample_buffers = 0; | 170 attribs.sample_buffers = 0; |
| 167 attribs.fail_if_major_perf_caveat = false; | 171 attribs.fail_if_major_perf_caveat = false; |
| 168 attribs.bind_generates_resource = false; | 172 attribs.bind_generates_resource = false; |
| 173 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; | |
| 174 #if defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW) | |
| 175 surface_handle = compositor->widget(); | |
| 176 #else | |
| 177 gpu::GpuSurfaceTracker* tracker = gpu::GpuSurfaceTracker::Get(); | |
| 178 surface_handle = tracker->AddSurfaceForNativeWidget(compositor->widget()); | |
|
piman
2016/11/16 20:48:50
Should we remove in RemoveCompositor?
| |
| 179 #endif | |
| 169 scoped_refptr<InProcessContextProvider> context_provider = | 180 scoped_refptr<InProcessContextProvider> context_provider = |
| 170 InProcessContextProvider::Create( | 181 InProcessContextProvider::Create( |
| 171 attribs, shared_worker_context_provider_.get(), | 182 attribs, shared_worker_context_provider_.get(), |
| 172 &gpu_memory_buffer_manager_, &image_factory_, compositor->widget(), | 183 &gpu_memory_buffer_manager_, &image_factory_, surface_handle, |
| 173 "UICompositor"); | 184 "UICompositor"); |
| 174 | 185 |
| 175 std::unique_ptr<cc::OutputSurface> display_output_surface; | 186 std::unique_ptr<cc::OutputSurface> display_output_surface; |
| 176 if (use_test_surface_) { | 187 if (use_test_surface_) { |
| 177 bool flipped_output_surface = false; | 188 bool flipped_output_surface = false; |
| 178 display_output_surface = base::MakeUnique<cc::PixelTestOutputSurface>( | 189 display_output_surface = base::MakeUnique<cc::PixelTestOutputSurface>( |
| 179 context_provider, flipped_output_surface); | 190 context_provider, flipped_output_surface); |
| 180 } else { | 191 } else { |
| 181 display_output_surface = | 192 display_output_surface = |
| 182 base::MakeUnique<DirectOutputSurface>(context_provider); | 193 base::MakeUnique<DirectOutputSurface>(context_provider); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 278 | 289 |
| 279 void InProcessContextFactory::AddObserver(ContextFactoryObserver* observer) { | 290 void InProcessContextFactory::AddObserver(ContextFactoryObserver* observer) { |
| 280 observer_list_.AddObserver(observer); | 291 observer_list_.AddObserver(observer); |
| 281 } | 292 } |
| 282 | 293 |
| 283 void InProcessContextFactory::RemoveObserver(ContextFactoryObserver* observer) { | 294 void InProcessContextFactory::RemoveObserver(ContextFactoryObserver* observer) { |
| 284 observer_list_.RemoveObserver(observer); | 295 observer_list_.RemoveObserver(observer); |
| 285 } | 296 } |
| 286 | 297 |
| 287 } // namespace ui | 298 } // namespace ui |
| OLD | NEW |