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

Side by Side Diff: ui/compositor/test/in_process_context_provider.cc

Issue 2286873003: Provide TaskRunner to ContextCacheController (Closed)
Patch Set: feedback Created 4 years, 3 months 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
« no previous file with comments | « services/ui/surfaces/surfaces_context_provider.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/compositor/test/in_process_context_provider.h" 5 #include "ui/compositor/test/in_process_context_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "base/threading/thread_task_runner_handle.h"
12 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
13 #include "cc/output/context_cache_controller.h" 14 #include "cc/output/context_cache_controller.h"
14 #include "cc/output/managed_memory_policy.h" 15 #include "cc/output/managed_memory_policy.h"
15 #include "gpu/command_buffer/client/gl_in_process_context.h" 16 #include "gpu/command_buffer/client/gl_in_process_context.h"
16 #include "gpu/command_buffer/client/gles2_implementation.h" 17 #include "gpu/command_buffer/client/gles2_implementation.h"
17 #include "gpu/command_buffer/client/gles2_lib.h" 18 #include "gpu/command_buffer/client/gles2_lib.h"
18 #include "gpu/command_buffer/client/shared_memory_limits.h" 19 #include "gpu/command_buffer/client/shared_memory_limits.h"
19 #include "gpu/skia_bindings/grcontext_for_gles2_interface.h" 20 #include "gpu/skia_bindings/grcontext_for_gles2_interface.h"
20 #include "third_party/skia/include/gpu/GrContext.h" 21 #include "third_party/skia/include/gpu/GrContext.h"
21 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" 22 #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // This is called on the thread the context will be used. 84 // This is called on the thread the context will be used.
84 DCHECK(context_thread_checker_.CalledOnValidThread()); 85 DCHECK(context_thread_checker_.CalledOnValidThread());
85 86
86 if (!context_) { 87 if (!context_) {
87 context_.reset(gpu::GLInProcessContext::Create( 88 context_.reset(gpu::GLInProcessContext::Create(
88 nullptr, /* service */ 89 nullptr, /* service */
89 nullptr, /* surface */ 90 nullptr, /* surface */
90 !window_, /* is_offscreen */ 91 !window_, /* is_offscreen */
91 window_, (shared_context_ ? shared_context_->context_.get() : nullptr), 92 window_, (shared_context_ ? shared_context_->context_.get() : nullptr),
92 attribs_, gpu::SharedMemoryLimits(), gpu_memory_buffer_manager_, 93 attribs_, gpu::SharedMemoryLimits(), gpu_memory_buffer_manager_,
93 image_factory_)); 94 image_factory_, base::ThreadTaskRunnerHandle::Get()));
94 95
95 if (!context_) 96 if (!context_)
96 return false; 97 return false;
97 98
98 cache_controller_.reset( 99 cache_controller_.reset(new cc::ContextCacheController(
99 new cc::ContextCacheController(context_->GetImplementation())); 100 context_->GetImplementation(), base::ThreadTaskRunnerHandle::Get()));
100 } 101 }
101 102
102 std::string unique_context_name = 103 std::string unique_context_name =
103 base::StringPrintf("%s-%p", debug_name_.c_str(), context_.get()); 104 base::StringPrintf("%s-%p", debug_name_.c_str(), context_.get());
104 context_->GetImplementation()->TraceBeginCHROMIUM( 105 context_->GetImplementation()->TraceBeginCHROMIUM(
105 "gpu_toplevel", unique_context_name.c_str()); 106 "gpu_toplevel", unique_context_name.c_str());
106 107
107 return true; 108 return true;
108 } 109 }
109 110
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 uint32_t InProcessContextProvider::GetCopyTextureInternalFormat() { 165 uint32_t InProcessContextProvider::GetCopyTextureInternalFormat() {
165 if (attribs_.alpha_size > 0) 166 if (attribs_.alpha_size > 0)
166 return GL_RGBA; 167 return GL_RGBA;
167 DCHECK_NE(attribs_.red_size, 0); 168 DCHECK_NE(attribs_.red_size, 0);
168 DCHECK_NE(attribs_.green_size, 0); 169 DCHECK_NE(attribs_.green_size, 0);
169 DCHECK_NE(attribs_.blue_size, 0); 170 DCHECK_NE(attribs_.blue_size, 0);
170 return GL_RGB; 171 return GL_RGB;
171 } 172 }
172 173
173 } // namespace ui 174 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/surfaces/surfaces_context_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698