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

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

Issue 1985973002: Defer compositor context creation to the thread. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: contextfactory: . Created 4 years, 7 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 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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 gpu::SharedMemoryLimits(), gpu_memory_buffer_manager, image_factory)); 51 gpu::SharedMemoryLimits(), gpu_memory_buffer_manager, image_factory));
52 52
53 DCHECK(context); 53 DCHECK(context);
54 return context; 54 return context;
55 } 55 }
56 56
57 std::unique_ptr<gpu::GLInProcessContext> CreateTestInProcessContext() { 57 std::unique_ptr<gpu::GLInProcessContext> CreateTestInProcessContext() {
58 return CreateTestInProcessContext(nullptr, nullptr, nullptr); 58 return CreateTestInProcessContext(nullptr, nullptr, nullptr);
59 } 59 }
60 60
61 scoped_refptr<ContextProvider>
62 TestInProcessContextProvider::Factory::CreateContext() {
63 return new TestInProcessContextProvider(shared_context_);
64 }
65
61 TestInProcessContextProvider::TestInProcessContextProvider( 66 TestInProcessContextProvider::TestInProcessContextProvider(
62 TestInProcessContextProvider* shared_context) 67 TestInProcessContextProvider* shared_context)
63 : context_(CreateTestInProcessContext( 68 : context_(CreateTestInProcessContext(
64 &gpu_memory_buffer_manager_, 69 &gpu_memory_buffer_manager_,
65 &image_factory_, 70 &image_factory_,
66 (shared_context ? shared_context->context_.get() : nullptr))) {} 71 (shared_context ? shared_context->context_.get() : nullptr))) {}
67 72
68 TestInProcessContextProvider::~TestInProcessContextProvider() { 73 TestInProcessContextProvider::~TestInProcessContextProvider() {
69 } 74 }
70 75
71 bool TestInProcessContextProvider::BindToCurrentThread() {
72 return true;
73 }
74
75 gpu::gles2::GLES2Interface* TestInProcessContextProvider::ContextGL() { 76 gpu::gles2::GLES2Interface* TestInProcessContextProvider::ContextGL() {
76 return context_->GetImplementation(); 77 return context_->GetImplementation();
77 } 78 }
78 79
79 gpu::ContextSupport* TestInProcessContextProvider::ContextSupport() { 80 gpu::ContextSupport* TestInProcessContextProvider::ContextSupport() {
80 return context_->GetImplementation(); 81 return context_->GetImplementation();
81 } 82 }
82 83
83 class GrContext* TestInProcessContextProvider::GrContext() { 84 class GrContext* TestInProcessContextProvider::GrContext() {
84 if (gr_context_) 85 if (gr_context_)
(...skipping 30 matching lines...) Expand all
115 116
116 void TestInProcessContextProvider::DeleteCachedResources() { 117 void TestInProcessContextProvider::DeleteCachedResources() {
117 if (gr_context_) 118 if (gr_context_)
118 gr_context_->FreeGpuResources(); 119 gr_context_->FreeGpuResources();
119 } 120 }
120 121
121 void TestInProcessContextProvider::SetLostContextCallback( 122 void TestInProcessContextProvider::SetLostContextCallback(
122 const LostContextCallback& lost_context_callback) {} 123 const LostContextCallback& lost_context_callback) {}
123 124
124 } // namespace cc 125 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698