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

Side by Side Diff: cc/resources/resource_provider_unittest.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resources/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 context3d_(NULL), 420 context3d_(NULL),
421 child_context_(NULL), 421 child_context_(NULL),
422 main_thread_task_runner_(BlockingTaskRunner::Create(NULL)) { 422 main_thread_task_runner_(BlockingTaskRunner::Create(NULL)) {
423 switch (GetParam()) { 423 switch (GetParam()) {
424 case ResourceProvider::RESOURCE_TYPE_GPU_MEMORY_BUFFER: 424 case ResourceProvider::RESOURCE_TYPE_GPU_MEMORY_BUFFER:
425 case ResourceProvider::RESOURCE_TYPE_GL_TEXTURE: { 425 case ResourceProvider::RESOURCE_TYPE_GL_TEXTURE: {
426 std::unique_ptr<ResourceProviderContext> context3d( 426 std::unique_ptr<ResourceProviderContext> context3d(
427 ResourceProviderContext::Create(shared_data_.get())); 427 ResourceProviderContext::Create(shared_data_.get()));
428 context3d_ = context3d.get(); 428 context3d_ = context3d.get();
429 429
430 scoped_refptr<TestContextProvider> context_provider = 430 output_surface_ = FakeOutputSurface::Create3d(
431 TestContextProvider::Create(std::move(context3d)); 431 base::MakeUnique<TestContextProvider::Factory>(
432 432 std::move(context3d)));
433 output_surface_ = FakeOutputSurface::Create3d(context_provider);
434 433
435 std::unique_ptr<ResourceProviderContext> child_context_owned = 434 std::unique_ptr<ResourceProviderContext> child_context_owned =
436 ResourceProviderContext::Create(shared_data_.get()); 435 ResourceProviderContext::Create(shared_data_.get());
437 child_context_ = child_context_owned.get(); 436 child_context_ = child_context_owned.get();
438 if (child_needs_sync_token) { 437 if (child_needs_sync_token) {
439 child_output_surface_ = 438 child_output_surface_ =
440 FakeOutputSurface::Create3d(std::move(child_context_owned)); 439 FakeOutputSurface::Create3d(std::move(child_context_owned));
441 } else { 440 } else {
442 child_output_surface_ = FakeOutputSurface::CreateNoRequireSyncPoint( 441 child_output_surface_ = FakeOutputSurface::CreateNoRequireSyncPoint(
443 std::move(child_context_owned)); 442 std::move(child_context_owned));
(...skipping 3246 matching lines...) Expand 10 before | Expand all | Expand 10 after
3690 EXPECT_TRUE(resource_provider_->CanLockForWrite(id)); 3689 EXPECT_TRUE(resource_provider_->CanLockForWrite(id));
3691 EXPECT_FALSE(resource_provider_->InUseByConsumer(id)); 3690 EXPECT_FALSE(resource_provider_->InUseByConsumer(id));
3692 gpu_memory_buffer_manager_->SetGpuMemoryBufferIsInUseByMacOSWindowServer( 3691 gpu_memory_buffer_manager_->SetGpuMemoryBufferIsInUseByMacOSWindowServer(
3693 gpu_memory_buffer, true); 3692 gpu_memory_buffer, true);
3694 EXPECT_FALSE(resource_provider_->CanLockForWrite(id)); 3693 EXPECT_FALSE(resource_provider_->CanLockForWrite(id));
3695 EXPECT_TRUE(resource_provider_->InUseByConsumer(id)); 3694 EXPECT_TRUE(resource_provider_->InUseByConsumer(id));
3696 } 3695 }
3697 3696
3698 } // namespace 3697 } // namespace
3699 } // namespace cc 3698 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698