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

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

Issue 160023002: cc: Only make num_threads - 1 SkPicture clones. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 6 years, 10 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 | Annotate | Revision Log
« cc/resources/picture.cc ('K') | « cc/resources/raster_worker_pool.h ('k') | 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/raster_worker_pool.h" 5 #include "cc/resources/raster_worker_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/debug/trace_event_synthetic_delay.h" 9 #include "base/debug/trace_event_synthetic_delay.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 private: 443 private:
444 virtual ~RasterRequiredForActivationFinishedWorkerPoolTaskImpl() {} 444 virtual ~RasterRequiredForActivationFinishedWorkerPoolTaskImpl() {}
445 445
446 base::TimeTicks activation_delay_end_time_; 446 base::TimeTicks activation_delay_end_time_;
447 const size_t tasks_required_for_activation_count_; 447 const size_t tasks_required_for_activation_count_;
448 448
449 DISALLOW_COPY_AND_ASSIGN( 449 DISALLOW_COPY_AND_ASSIGN(
450 RasterRequiredForActivationFinishedWorkerPoolTaskImpl); 450 RasterRequiredForActivationFinishedWorkerPoolTaskImpl);
451 }; 451 };
452 452
453 class RasterTaskGraphRunner : public internal::TaskGraphRunner {
454 public:
455 RasterTaskGraphRunner()
456 : internal::TaskGraphRunner(RasterWorkerPool::GetNumRasterThreads(),
457 "CompositorRaster") {}
458 };
459 base::LazyInstance<RasterTaskGraphRunner>::Leaky g_task_graph_runner =
460 LAZY_INSTANCE_INITIALIZER;
461
453 const int kDefaultNumRasterThreads = 1; 462 const int kDefaultNumRasterThreads = 1;
454 463
455 int g_num_raster_threads = 0; 464 int g_num_raster_threads = 0;
456 465
457 } // namespace 466 } // namespace
458 467
459 namespace internal { 468 namespace internal {
460 469
461 WorkerPoolTask::WorkerPoolTask() : did_schedule_(false), did_complete_(false) {} 470 WorkerPoolTask::WorkerPoolTask() : did_schedule_(false), did_complete_(false) {}
462 471
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 RasterWorkerPool::RasterTask::RasterTask() {} 556 RasterWorkerPool::RasterTask::RasterTask() {}
548 557
549 RasterWorkerPool::RasterTask::RasterTask( 558 RasterWorkerPool::RasterTask::RasterTask(
550 internal::RasterWorkerPoolTask* internal) 559 internal::RasterWorkerPoolTask* internal)
551 : internal_(internal) {} 560 : internal_(internal) {}
552 561
553 void RasterWorkerPool::RasterTask::Reset() { internal_ = NULL; } 562 void RasterWorkerPool::RasterTask::Reset() { internal_ = NULL; }
554 563
555 RasterWorkerPool::RasterTask::~RasterTask() {} 564 RasterWorkerPool::RasterTask::~RasterTask() {}
556 565
566 // This allows an external rasterize on-demand system to run raster tasks
567 // with highest priority using the same task graph runner instance.
568 unsigned RasterWorkerPool::kOnDemandRasterTaskPriority = 0u;
557 // Task priorities that make sure raster finished tasks run before any 569 // Task priorities that make sure raster finished tasks run before any
558 // remaining raster tasks. 570 // remaining raster tasks.
559 unsigned RasterWorkerPool::kRasterFinishedTaskPriority = 1u; 571 unsigned RasterWorkerPool::kRasterFinishedTaskPriority = 2u;
560 unsigned RasterWorkerPool::kRasterRequiredForActivationFinishedTaskPriority = 572 unsigned RasterWorkerPool::kRasterRequiredForActivationFinishedTaskPriority =
561 0u; 573 1u;
562 unsigned RasterWorkerPool::kRasterTaskPriorityBase = 2u; 574 unsigned RasterWorkerPool::kRasterTaskPriorityBase = 3u;
563 575
564 RasterWorkerPool::RasterWorkerPool(internal::TaskGraphRunner* task_graph_runner, 576 RasterWorkerPool::RasterWorkerPool(internal::TaskGraphRunner* task_graph_runner,
565 ResourceProvider* resource_provider, 577 ResourceProvider* resource_provider,
566 ContextProvider* context_provider) 578 ContextProvider* context_provider)
567 : task_graph_runner_(task_graph_runner), 579 : task_graph_runner_(task_graph_runner),
568 namespace_token_(task_graph_runner_->GetNamespaceToken()), 580 namespace_token_(task_graph_runner_->GetNamespaceToken()),
569 client_(NULL), 581 client_(NULL),
570 resource_provider_(resource_provider), 582 resource_provider_(resource_provider),
571 context_provider_(context_provider), 583 context_provider_(context_provider),
572 weak_ptr_factory_(this) {} 584 weak_ptr_factory_(this) {}
(...skipping 10 matching lines...) Expand all
583 595
584 // static 596 // static
585 int RasterWorkerPool::GetNumRasterThreads() { 597 int RasterWorkerPool::GetNumRasterThreads() {
586 if (!g_num_raster_threads) 598 if (!g_num_raster_threads)
587 g_num_raster_threads = kDefaultNumRasterThreads; 599 g_num_raster_threads = kDefaultNumRasterThreads;
588 600
589 return g_num_raster_threads; 601 return g_num_raster_threads;
590 } 602 }
591 603
592 // static 604 // static
605 internal::TaskGraphRunner* RasterWorkerPool::GetTaskGraphRunner() {
606 return g_task_graph_runner.Pointer();
607 }
608
609 // static
593 RasterWorkerPool::RasterTask RasterWorkerPool::CreateRasterTask( 610 RasterWorkerPool::RasterTask RasterWorkerPool::CreateRasterTask(
594 const Resource* resource, 611 const Resource* resource,
595 PicturePileImpl* picture_pile, 612 PicturePileImpl* picture_pile,
596 const gfx::Rect& content_rect, 613 const gfx::Rect& content_rect,
597 float contents_scale, 614 float contents_scale,
598 RasterMode raster_mode, 615 RasterMode raster_mode,
599 TileResolution tile_resolution, 616 TileResolution tile_resolution,
600 int layer_id, 617 int layer_id,
601 const void* tile_id, 618 const void* tile_id,
602 int source_frame_number, 619 int source_frame_number,
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 if (decode_it == graph->nodes.end()) 811 if (decode_it == graph->nodes.end())
795 InsertNodeForTask(graph, decode_task, priority, 0u); 812 InsertNodeForTask(graph, decode_task, priority, 0u);
796 813
797 graph->edges.push_back(internal::TaskGraph::Edge(decode_task, raster_task)); 814 graph->edges.push_back(internal::TaskGraph::Edge(decode_task, raster_task));
798 } 815 }
799 816
800 InsertNodeForTask(graph, raster_task, priority, dependencies); 817 InsertNodeForTask(graph, raster_task, priority, dependencies);
801 } 818 }
802 819
803 } // namespace cc 820 } // namespace cc
OLDNEW
« cc/resources/picture.cc ('K') | « cc/resources/raster_worker_pool.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698