| Index: cc/test/test_context_provider.cc
|
| diff --git a/cc/test/test_context_provider.cc b/cc/test/test_context_provider.cc
|
| index 31ef12e9c55164bc791d9460204204a0358d7f60..2634aff5cb567bf4757caefef8c23a8219b7f07a 100644
|
| --- a/cc/test/test_context_provider.cc
|
| +++ b/cc/test/test_context_provider.cc
|
| @@ -23,13 +23,17 @@ namespace cc {
|
|
|
| // static
|
| scoped_refptr<TestContextProvider> TestContextProvider::Create() {
|
| - return Create(TestWebGraphicsContext3D::Create());
|
| + return new TestContextProvider(base::MakeUnique<TestContextSupport>(),
|
| + base::MakeUnique<TestGLES2Interface>(),
|
| + TestWebGraphicsContext3D::Create());
|
| }
|
|
|
| // static
|
| scoped_refptr<TestContextProvider> TestContextProvider::CreateWorker() {
|
| - scoped_refptr<TestContextProvider> worker_context_provider =
|
| - Create(TestWebGraphicsContext3D::Create());
|
| + scoped_refptr<TestContextProvider> worker_context_provider(
|
| + new TestContextProvider(base::MakeUnique<TestContextSupport>(),
|
| + base::MakeUnique<TestGLES2Interface>(),
|
| + TestWebGraphicsContext3D::Create()));
|
| // Worker contexts are bound to the thread they are created on.
|
| if (!worker_context_provider->BindToCurrentThread())
|
| return nullptr;
|
| @@ -40,7 +44,8 @@ scoped_refptr<TestContextProvider> TestContextProvider::CreateWorker() {
|
| scoped_refptr<TestContextProvider> TestContextProvider::Create(
|
| std::unique_ptr<TestWebGraphicsContext3D> context) {
|
| DCHECK(context);
|
| - return new TestContextProvider(base::MakeUnique<TestGLES2Interface>(),
|
| + return new TestContextProvider(base::MakeUnique<TestContextSupport>(),
|
| + base::MakeUnique<TestGLES2Interface>(),
|
| std::move(context));
|
| }
|
|
|
| @@ -48,23 +53,36 @@ scoped_refptr<TestContextProvider> TestContextProvider::Create(
|
| scoped_refptr<TestContextProvider> TestContextProvider::Create(
|
| std::unique_ptr<TestGLES2Interface> gl) {
|
| DCHECK(gl);
|
| - return new TestContextProvider(std::move(gl),
|
| + return new TestContextProvider(base::MakeUnique<TestContextSupport>(),
|
| + std::move(gl),
|
| TestWebGraphicsContext3D::Create());
|
| }
|
|
|
| +// static
|
| +scoped_refptr<TestContextProvider> TestContextProvider::Create(
|
| + std::unique_ptr<TestWebGraphicsContext3D> context,
|
| + std::unique_ptr<TestContextSupport> support) {
|
| + DCHECK(context);
|
| + DCHECK(support);
|
| + return new TestContextProvider(std::move(support),
|
| + base::MakeUnique<TestGLES2Interface>(),
|
| + std::move(context));
|
| +}
|
| +
|
| TestContextProvider::TestContextProvider(
|
| + std::unique_ptr<TestContextSupport> support,
|
| std::unique_ptr<TestGLES2Interface> gl,
|
| std::unique_ptr<TestWebGraphicsContext3D> context)
|
| - : context3d_(std::move(context)),
|
| + : support_(std::move(support)),
|
| + context3d_(std::move(context)),
|
| context_gl_(std::move(gl)),
|
| - bound_(false),
|
| weak_ptr_factory_(this) {
|
| DCHECK(main_thread_checker_.CalledOnValidThread());
|
| DCHECK(context3d_);
|
| DCHECK(context_gl_);
|
| context_thread_checker_.DetachFromThread();
|
| context_gl_->set_test_context(context3d_.get());
|
| - context3d_->set_test_support(&support_);
|
| + context3d_->set_test_support(support_.get());
|
| }
|
|
|
| TestContextProvider::~TestContextProvider() {
|
| @@ -110,7 +128,7 @@ gpu::gles2::GLES2Interface* TestContextProvider::ContextGL() {
|
| }
|
|
|
| gpu::ContextSupport* TestContextProvider::ContextSupport() {
|
| - return &support_;
|
| + return support();
|
| }
|
|
|
| class GrContext* TestContextProvider::GrContext() {
|
|
|