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

Side by Side Diff: cc/resources/tile_task_worker_pool_perftest.cc

Issue 807193005: cc: cc_perftest was crashing due to lack of GrContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | « no previous file | 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 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/resources/tile_task_worker_pool.h" 5 #include "cc/resources/tile_task_worker_pool.h"
6 6
7 #include "base/test/test_simple_task_runner.h" 7 #include "base/test/test_simple_task_runner.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "cc/debug/lap_timer.h" 9 #include "cc/debug/lap_timer.h"
10 #include "cc/output/context_provider.h" 10 #include "cc/output/context_provider.h"
11 #include "cc/resources/bitmap_tile_task_worker_pool.h" 11 #include "cc/resources/bitmap_tile_task_worker_pool.h"
12 #include "cc/resources/gpu_tile_task_worker_pool.h" 12 #include "cc/resources/gpu_tile_task_worker_pool.h"
13 #include "cc/resources/one_copy_tile_task_worker_pool.h" 13 #include "cc/resources/one_copy_tile_task_worker_pool.h"
14 #include "cc/resources/pixel_buffer_tile_task_worker_pool.h" 14 #include "cc/resources/pixel_buffer_tile_task_worker_pool.h"
15 #include "cc/resources/raster_buffer.h" 15 #include "cc/resources/raster_buffer.h"
16 #include "cc/resources/resource_pool.h" 16 #include "cc/resources/resource_pool.h"
17 #include "cc/resources/resource_provider.h" 17 #include "cc/resources/resource_provider.h"
18 #include "cc/resources/scoped_resource.h" 18 #include "cc/resources/scoped_resource.h"
19 #include "cc/resources/tile_task_runner.h" 19 #include "cc/resources/tile_task_runner.h"
20 #include "cc/resources/zero_copy_tile_task_worker_pool.h" 20 #include "cc/resources/zero_copy_tile_task_worker_pool.h"
21 #include "cc/test/fake_output_surface.h" 21 #include "cc/test/fake_output_surface.h"
22 #include "cc/test/fake_output_surface_client.h" 22 #include "cc/test/fake_output_surface_client.h"
23 #include "cc/test/test_context_support.h" 23 #include "cc/test/test_context_support.h"
24 #include "cc/test/test_gpu_memory_buffer_manager.h" 24 #include "cc/test/test_gpu_memory_buffer_manager.h"
25 #include "cc/test/test_shared_bitmap_manager.h" 25 #include "cc/test/test_shared_bitmap_manager.h"
26 #include "cc/test/test_web_graphics_context_3d.h" 26 #include "cc/test/test_web_graphics_context_3d.h"
27 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
28 #include "testing/perf/perf_test.h" 28 #include "testing/perf/perf_test.h"
29 #include "third_party/khronos/GLES2/gl2.h" 29 #include "third_party/khronos/GLES2/gl2.h"
30 #include "third_party/skia/include/gpu/GrContext.h"
31 #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
30 32
31 namespace cc { 33 namespace cc {
32 namespace { 34 namespace {
33 35
34 class PerfGLES2Interface : public gpu::gles2::GLES2InterfaceStub { 36 class PerfGLES2Interface : public gpu::gles2::GLES2InterfaceStub {
35 // Overridden from gpu::gles2::GLES2Interface: 37 // Overridden from gpu::gles2::GLES2Interface:
36 GLuint CreateImageCHROMIUM(ClientBuffer buffer, 38 GLuint CreateImageCHROMIUM(ClientBuffer buffer,
37 GLsizei width, 39 GLsizei width,
38 GLsizei height, 40 GLsizei height,
39 GLenum internalformat) override { 41 GLenum internalformat) override {
(...skipping 29 matching lines...) Expand all
69 71
70 bool BindToCurrentThread() override { return true; } 72 bool BindToCurrentThread() override { return true; }
71 Capabilities ContextCapabilities() override { 73 Capabilities ContextCapabilities() override {
72 Capabilities capabilities; 74 Capabilities capabilities;
73 capabilities.gpu.image = true; 75 capabilities.gpu.image = true;
74 capabilities.gpu.sync_query = true; 76 capabilities.gpu.sync_query = true;
75 return capabilities; 77 return capabilities;
76 } 78 }
77 gpu::gles2::GLES2Interface* ContextGL() override { return context_gl_.get(); } 79 gpu::gles2::GLES2Interface* ContextGL() override { return context_gl_.get(); }
78 gpu::ContextSupport* ContextSupport() override { return &support_; } 80 gpu::ContextSupport* ContextSupport() override { return &support_; }
79 class GrContext* GrContext() override { 81 class GrContext* GrContext() override {
tfarina 2014/12/20 00:59:25 class GrContext? I bet you don't need 'class' here
80 return NULL; 82 if (gr_context_)
83 return gr_context_.get();
84
85 auto null_interface = skia::AdoptRef(GrGLCreateNullInterface());
tfarina 2014/12/20 00:59:25 s/auto/skia::RefPtr<GrContext> ?
vmpstr 2014/12/20 01:17:18 FWIW, It's as common knowledge that skia::AdoptRef
danakj 2014/12/20 06:45:00 I think "don't use auto for smart pointers" is a s
86 gr_context_ = skia::AdoptRef(GrContext::Create(
87 kOpenGL_GrBackend,
88 reinterpret_cast<GrBackendContext>(null_interface.get())));
89 return gr_context_.get();
81 } 90 }
82 bool IsContextLost() override { return false; } 91 bool IsContextLost() override { return false; }
83 void VerifyContexts() override {} 92 void VerifyContexts() override {}
84 void DeleteCachedResources() override {} 93 void DeleteCachedResources() override {}
85 bool DestroyedOnMainThread() override { return false; } 94 bool DestroyedOnMainThread() override { return false; }
86 void SetLostContextCallback(const LostContextCallback& cb) override {} 95 void SetLostContextCallback(const LostContextCallback& cb) override {}
87 void SetMemoryPolicyChangedCallback( 96 void SetMemoryPolicyChangedCallback(
88 const MemoryPolicyChangedCallback& cb) override {} 97 const MemoryPolicyChangedCallback& cb) override {}
89 98
90 private: 99 private:
91 ~PerfContextProvider() override {} 100 ~PerfContextProvider() override {}
92 101
93 scoped_ptr<PerfGLES2Interface> context_gl_; 102 scoped_ptr<PerfGLES2Interface> context_gl_;
103 skia::RefPtr<class GrContext> gr_context_;
tfarina 2014/12/20 00:59:25 you don't need 'class' here, right?
94 TestContextSupport support_; 104 TestContextSupport support_;
95 }; 105 };
96 106
97 enum TileTaskWorkerPoolType { 107 enum TileTaskWorkerPoolType {
98 TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, 108 TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER,
99 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, 109 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY,
100 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, 110 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY,
101 TILE_TASK_WORKER_POOL_TYPE_GPU, 111 TILE_TASK_WORKER_POOL_TYPE_GPU,
102 TILE_TASK_WORKER_POOL_TYPE_BITMAP 112 TILE_TASK_WORKER_POOL_TYPE_BITMAP
103 }; 113 };
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 RunBuildTileTaskQueueTest("1_0", 1, 0); 503 RunBuildTileTaskQueueTest("1_0", 1, 0);
494 RunBuildTileTaskQueueTest("32_0", 32, 0); 504 RunBuildTileTaskQueueTest("32_0", 32, 0);
495 RunBuildTileTaskQueueTest("1_1", 1, 1); 505 RunBuildTileTaskQueueTest("1_1", 1, 1);
496 RunBuildTileTaskQueueTest("32_1", 32, 1); 506 RunBuildTileTaskQueueTest("32_1", 32, 1);
497 RunBuildTileTaskQueueTest("1_4", 1, 4); 507 RunBuildTileTaskQueueTest("1_4", 1, 4);
498 RunBuildTileTaskQueueTest("32_4", 32, 4); 508 RunBuildTileTaskQueueTest("32_4", 32, 4);
499 } 509 }
500 510
501 } // namespace 511 } // namespace
502 } // namespace cc 512 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698