OLD | NEW |
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 "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "cc/debug/devtools_instrumentation.h" | 10 #include "cc/debug/devtools_instrumentation.h" |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 internal::RasterWorkerPoolTask* task) const { | 560 internal::RasterWorkerPoolTask* task) const { |
561 return | 561 return |
562 raster_tasks_required_for_activation_.find(task) != | 562 raster_tasks_required_for_activation_.find(task) != |
563 raster_tasks_required_for_activation_.end(); | 563 raster_tasks_required_for_activation_.end(); |
564 } | 564 } |
565 | 565 |
566 void RasterWorkerPool::RunGpuRasterTasks(const RasterTaskVector& tasks) { | 566 void RasterWorkerPool::RunGpuRasterTasks(const RasterTaskVector& tasks) { |
567 if (tasks.empty()) | 567 if (tasks.empty()) |
568 return; | 568 return; |
569 | 569 |
570 blink::WebGraphicsContext3D* context = context_provider_->Context3d(); | 570 context_provider_->MakeGrContextCurrent(); |
571 if (!context->makeContextCurrent()) | |
572 return; | |
573 | 571 |
574 GrContext* gr_context = context_provider_->GrContext(); | 572 GrContext* gr_context = context_provider_->GrContext(); |
575 // TODO(alokp): Implement TestContextProvider::GrContext(). | 573 // TODO(alokp): Implement TestContextProvider::GrContext(). |
576 if (gr_context) gr_context->resetContext(); | 574 if (gr_context) |
| 575 gr_context->resetContext(); |
577 | 576 |
578 for (RasterTaskVector::const_iterator it = tasks.begin(); | 577 for (RasterTaskVector::const_iterator it = tasks.begin(); |
579 it != tasks.end(); ++it) { | 578 it != tasks.end(); ++it) { |
580 internal::RasterWorkerPoolTask* task = it->get(); | 579 internal::RasterWorkerPoolTask* task = it->get(); |
581 DCHECK(task->use_gpu_rasterization()); | 580 DCHECK(task->use_gpu_rasterization()); |
582 | 581 |
583 task->RunOnOriginThread(resource_provider_, context_provider_); | 582 task->RunOnOriginThread(resource_provider_, context_provider_); |
584 task->DidRun(false); | 583 task->DidRun(false); |
585 completed_gpu_raster_tasks_.push_back(task); | 584 completed_gpu_raster_tasks_.push_back(task); |
586 } | 585 } |
587 | 586 |
588 // TODO(alokp): Implement TestContextProvider::GrContext(). | 587 // TODO(alokp): Implement TestContextProvider::GrContext(). |
589 if (gr_context) gr_context->flush(); | 588 if (gr_context) |
| 589 gr_context->flush(); |
590 } | 590 } |
591 | 591 |
592 scoped_refptr<internal::WorkerPoolTask> | 592 scoped_refptr<internal::WorkerPoolTask> |
593 RasterWorkerPool::CreateRasterFinishedTask() { | 593 RasterWorkerPool::CreateRasterFinishedTask() { |
594 return make_scoped_refptr( | 594 return make_scoped_refptr( |
595 new RasterFinishedWorkerPoolTaskImpl( | 595 new RasterFinishedWorkerPoolTaskImpl( |
596 base::Bind(&RasterWorkerPool::OnRasterFinished, | 596 base::Bind(&RasterWorkerPool::OnRasterFinished, |
597 weak_ptr_factory_.GetWeakPtr()))); | 597 weak_ptr_factory_.GetWeakPtr()))); |
598 } | 598 } |
599 | 599 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 | 679 |
680 internal::GraphNode* decode_node = CreateGraphNodeForTask( | 680 internal::GraphNode* decode_node = CreateGraphNodeForTask( |
681 decode_task, priority, graph); | 681 decode_task, priority, graph); |
682 decode_node->add_dependent(raster_node); | 682 decode_node->add_dependent(raster_node); |
683 } | 683 } |
684 | 684 |
685 return raster_node; | 685 return raster_node; |
686 } | 686 } |
687 | 687 |
688 } // namespace cc | 688 } // namespace cc |
OLD | NEW |