Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: cc/test/test_in_process_context_provider.cc

Issue 665463003: gpu: Add CHROMIUM_image support to in-process command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-gpu-memory-buffer-factory-to-gpu-image-factory
Patch Set: fix HardwareRenderer Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "cc/test/test_in_process_context_provider.h" 5 #include "cc/test/test_in_process_context_provider.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "gpu/GLES2/gl2extchromium.h" 8 #include "gpu/GLES2/gl2extchromium.h"
9 #include "gpu/command_buffer/client/gl_in_process_context.h" 9 #include "gpu/command_buffer/client/gl_in_process_context.h"
10 #include "gpu/command_buffer/client/gles2_implementation.h" 10 #include "gpu/command_buffer/client/gles2_implementation.h"
11 #include "gpu/command_buffer/client/gles2_lib.h" 11 #include "gpu/command_buffer/client/gles2_lib.h"
12 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 12 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
13 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" 13 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h"
14 #include "third_party/khronos/GLES2/gl2.h" 14 #include "third_party/khronos/GLES2/gl2.h"
15 #include "third_party/khronos/GLES2/gl2ext.h" 15 #include "third_party/khronos/GLES2/gl2ext.h"
16 #include "third_party/skia/include/gpu/GrContext.h" 16 #include "third_party/skia/include/gpu/GrContext.h"
17 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" 17 #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
18 #include "ui/gfx/native_widget_types.h" 18 #include "ui/gfx/native_widget_types.h"
19 19
20 namespace cc { 20 namespace cc {
21 21
22 // static 22 // static
23 scoped_ptr<gpu::GLInProcessContext> CreateTestInProcessContext() { 23 scoped_ptr<gpu::GLInProcessContext> CreateTestInProcessContext(
24 TestGpuMemoryBufferManager* gpu_memory_buffer_manager,
25 TestImageFactory* image_factory) {
24 const bool is_offscreen = true; 26 const bool is_offscreen = true;
25 const bool share_resources = true; 27 const bool share_resources = true;
26 gpu::gles2::ContextCreationAttribHelper attribs; 28 gpu::gles2::ContextCreationAttribHelper attribs;
27 attribs.alpha_size = 8; 29 attribs.alpha_size = 8;
28 attribs.blue_size = 8; 30 attribs.blue_size = 8;
29 attribs.green_size = 8; 31 attribs.green_size = 8;
30 attribs.red_size = 8; 32 attribs.red_size = 8;
31 attribs.depth_size = 24; 33 attribs.depth_size = 24;
32 attribs.stencil_size = 8; 34 attribs.stencil_size = 8;
33 attribs.samples = 0; 35 attribs.samples = 0;
34 attribs.sample_buffers = 0; 36 attribs.sample_buffers = 0;
35 attribs.fail_if_major_perf_caveat = false; 37 attribs.fail_if_major_perf_caveat = false;
36 attribs.bind_generates_resource = false; 38 attribs.bind_generates_resource = false;
37 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; 39 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
38 40
39 scoped_ptr<gpu::GLInProcessContext> context = 41 scoped_ptr<gpu::GLInProcessContext> context =
40 make_scoped_ptr(gpu::GLInProcessContext::Create( 42 make_scoped_ptr(gpu::GLInProcessContext::Create(
41 NULL, 43 NULL,
42 NULL, 44 NULL,
43 is_offscreen, 45 is_offscreen,
44 gfx::kNullAcceleratedWidget, 46 gfx::kNullAcceleratedWidget,
45 gfx::Size(1, 1), 47 gfx::Size(1, 1),
46 NULL, 48 NULL,
47 share_resources, 49 share_resources,
48 attribs, 50 attribs,
49 gpu_preference, 51 gpu_preference,
50 gpu::GLInProcessContextSharedMemoryLimits())); 52 gpu::GLInProcessContextSharedMemoryLimits(),
53 gpu_memory_buffer_manager,
54 image_factory));
51 55
52 DCHECK(context); 56 DCHECK(context);
53 return context.Pass(); 57 return context.Pass();
54 } 58 }
55 59
60 scoped_ptr<gpu::GLInProcessContext> CreateTestInProcessContext() {
61 return CreateTestInProcessContext(nullptr, nullptr);
62 }
63
56 TestInProcessContextProvider::TestInProcessContextProvider() 64 TestInProcessContextProvider::TestInProcessContextProvider()
57 : context_(CreateTestInProcessContext()) {} 65 : context_(CreateTestInProcessContext(&gpu_memory_buffer_manager_,
66 &image_factory_)) {
67 }
58 68
59 TestInProcessContextProvider::~TestInProcessContextProvider() { 69 TestInProcessContextProvider::~TestInProcessContextProvider() {
60 } 70 }
61 71
62 bool TestInProcessContextProvider::BindToCurrentThread() { return true; } 72 bool TestInProcessContextProvider::BindToCurrentThread() { return true; }
63 73
64 gpu::gles2::GLES2Interface* TestInProcessContextProvider::ContextGL() { 74 gpu::gles2::GLES2Interface* TestInProcessContextProvider::ContextGL() {
65 return context_->GetImplementation(); 75 return context_->GetImplementation();
66 } 76 }
67 77
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 140
131 bool TestInProcessContextProvider::DestroyedOnMainThread() { return false; } 141 bool TestInProcessContextProvider::DestroyedOnMainThread() { return false; }
132 142
133 void TestInProcessContextProvider::SetLostContextCallback( 143 void TestInProcessContextProvider::SetLostContextCallback(
134 const LostContextCallback& lost_context_callback) {} 144 const LostContextCallback& lost_context_callback) {}
135 145
136 void TestInProcessContextProvider::SetMemoryPolicyChangedCallback( 146 void TestInProcessContextProvider::SetMemoryPolicyChangedCallback(
137 const MemoryPolicyChangedCallback& memory_policy_changed_callback) {} 147 const MemoryPolicyChangedCallback& memory_policy_changed_callback) {}
138 148
139 } // namespace cc 149 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_in_process_context_provider.h ('k') | content/browser/android/in_process/synchronous_compositor_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698