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

Side by Side Diff: blimp/client/support/compositor/blimp_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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "blimp/client/support/compositor/blimp_context_provider.h" 5 #include "blimp/client/support/compositor/blimp_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/threading/thread_task_runner_handle.h"
10 #include "cc/output/context_cache_controller.h" 11 #include "cc/output/context_cache_controller.h"
11 #include "gpu/command_buffer/client/gl_in_process_context.h" 12 #include "gpu/command_buffer/client/gl_in_process_context.h"
12 #include "gpu/command_buffer/client/gles2_implementation.h" 13 #include "gpu/command_buffer/client/gles2_implementation.h"
13 #include "gpu/command_buffer/client/gles2_lib.h" 14 #include "gpu/command_buffer/client/gles2_lib.h"
14 #include "gpu/command_buffer/client/shared_memory_limits.h" 15 #include "gpu/command_buffer/client/shared_memory_limits.h"
15 #include "gpu/skia_bindings/grcontext_for_gles2_interface.h" 16 #include "gpu/skia_bindings/grcontext_for_gles2_interface.h"
16 #include "third_party/skia/include/gpu/GrContext.h" 17 #include "third_party/skia/include/gpu/GrContext.h"
17 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" 18 #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
18 19
19 namespace blimp { 20 namespace blimp {
(...skipping 19 matching lines...) Expand all
39 attribs_for_gles2.sample_buffers = 0; 40 attribs_for_gles2.sample_buffers = 0;
40 attribs_for_gles2.fail_if_major_perf_caveat = false; 41 attribs_for_gles2.fail_if_major_perf_caveat = false;
41 attribs_for_gles2.bind_generates_resource = false; 42 attribs_for_gles2.bind_generates_resource = false;
42 attribs_for_gles2.context_type = gpu::gles2::CONTEXT_TYPE_OPENGLES2; 43 attribs_for_gles2.context_type = gpu::gles2::CONTEXT_TYPE_OPENGLES2;
43 attribs_for_gles2.lose_context_when_out_of_memory = true; 44 attribs_for_gles2.lose_context_when_out_of_memory = true;
44 45
45 context_.reset(gpu::GLInProcessContext::Create( 46 context_.reset(gpu::GLInProcessContext::Create(
46 nullptr /* service */, nullptr /* surface */, 47 nullptr /* service */, nullptr /* surface */,
47 widget == gfx::kNullAcceleratedWidget /* is_offscreen */, widget, 48 widget == gfx::kNullAcceleratedWidget /* is_offscreen */, widget,
48 nullptr /* share_context */, attribs_for_gles2, gpu::SharedMemoryLimits(), 49 nullptr /* share_context */, attribs_for_gles2, gpu::SharedMemoryLimits(),
49 gpu_memory_buffer_manager, nullptr /* memory_limits */)); 50 gpu_memory_buffer_manager, nullptr /* memory_limits */,
51 base::ThreadTaskRunnerHandle::Get()));
50 context_->GetImplementation()->SetLostContextCallback( 52 context_->GetImplementation()->SetLostContextCallback(
51 base::Bind(&BlimpContextProvider::OnLostContext, base::Unretained(this))); 53 base::Bind(&BlimpContextProvider::OnLostContext, base::Unretained(this)));
52 54 cache_controller_.reset(new cc::ContextCacheController(
53 cache_controller_.reset( 55 context_->GetImplementation(), base::ThreadTaskRunnerHandle::Get()));
54 new cc::ContextCacheController(context_->GetImplementation()));
55 } 56 }
56 57
57 BlimpContextProvider::~BlimpContextProvider() { 58 BlimpContextProvider::~BlimpContextProvider() {
58 DCHECK(main_thread_checker_.CalledOnValidThread() || 59 DCHECK(main_thread_checker_.CalledOnValidThread() ||
59 context_thread_checker_.CalledOnValidThread()); 60 context_thread_checker_.CalledOnValidThread());
60 } 61 }
61 62
62 bool BlimpContextProvider::BindToCurrentThread() { 63 bool BlimpContextProvider::BindToCurrentThread() {
63 DCHECK(context_thread_checker_.CalledOnValidThread()); 64 DCHECK(context_thread_checker_.CalledOnValidThread());
64 return true; 65 return true;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 void BlimpContextProvider::OnLostContext() { 120 void BlimpContextProvider::OnLostContext() {
120 DCHECK(context_thread_checker_.CalledOnValidThread()); 121 DCHECK(context_thread_checker_.CalledOnValidThread());
121 if (!lost_context_callback_.is_null()) 122 if (!lost_context_callback_.is_null())
122 lost_context_callback_.Run(); 123 lost_context_callback_.Run();
123 if (gr_context_) 124 if (gr_context_)
124 gr_context_->OnLostContext(); 125 gr_context_->OnLostContext();
125 } 126 }
126 127
127 } // namespace client 128 } // namespace client
128 } // namespace blimp 129 } // namespace blimp
OLDNEW
« no previous file with comments | « android_webview/browser/aw_render_thread_context_provider.cc ('k') | cc/output/context_cache_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698