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

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

Issue 421183003: Revert of Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
« no previous file with comments | « cc/resources/pixel_buffer_raster_worker_pool.h ('k') | cc/resources/raster_mode.h » ('j') | 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/pixel_buffer_raster_worker_pool.h" 5 #include "cc/resources/pixel_buffer_raster_worker_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/containers/stack_container.h" 9 #include "base/containers/stack_container.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/debug/trace_event_argument.h"
12 #include "cc/debug/traced_value.h" 11 #include "cc/debug/traced_value.h"
13 #include "cc/resources/resource.h" 12 #include "cc/resources/resource.h"
14 #include "gpu/command_buffer/client/gles2_interface.h" 13 #include "gpu/command_buffer/client/gles2_interface.h"
15 14
16 namespace cc { 15 namespace cc {
17 namespace { 16 namespace {
18 17
19 const int kCheckForCompletedRasterTasksDelayMs = 6; 18 const int kCheckForCompletedRasterTasksDelayMs = 6;
20 19
21 const size_t kMaxScheduledRasterTasks = 48; 20 const size_t kMaxScheduledRasterTasks = 48;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 CheckForCompletedUploads(); 215 CheckForCompletedUploads();
217 FlushUploads(); 216 FlushUploads();
218 217
219 // Schedule new tasks. 218 // Schedule new tasks.
220 ScheduleMoreTasks(); 219 ScheduleMoreTasks();
221 220
222 // Reschedule check for completed raster tasks. 221 // Reschedule check for completed raster tasks.
223 check_for_completed_raster_task_notifier_.Schedule(); 222 check_for_completed_raster_task_notifier_.Schedule();
224 223
225 TRACE_EVENT_ASYNC_STEP_INTO1( 224 TRACE_EVENT_ASYNC_STEP_INTO1(
226 "cc", "ScheduledTasks", this, StateName(), "state", StateAsValue()); 225 "cc",
226 "ScheduledTasks",
227 this,
228 StateName(),
229 "state",
230 TracedValue::FromValue(StateAsValue().release()));
227 } 231 }
228 232
229 void PixelBufferRasterWorkerPool::CheckForCompletedTasks() { 233 void PixelBufferRasterWorkerPool::CheckForCompletedTasks() {
230 TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::CheckForCompletedTasks"); 234 TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::CheckForCompletedTasks");
231 235
232 CheckForCompletedRasterizerTasks(); 236 CheckForCompletedRasterizerTasks();
233 CheckForCompletedUploads(); 237 CheckForCompletedUploads();
234 FlushUploads(); 238 FlushUploads();
235 239
236 for (RasterizerTask::Vector::const_iterator it = 240 for (RasterizerTask::Vector::const_iterator it =
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 should_notify_client_if_no_tasks_required_for_activation_are_pending_ &= 453 should_notify_client_if_no_tasks_required_for_activation_are_pending_ &=
450 !will_notify_client_that_no_tasks_required_for_activation_are_pending; 454 !will_notify_client_that_no_tasks_required_for_activation_are_pending;
451 should_notify_client_if_no_tasks_are_pending_ &= 455 should_notify_client_if_no_tasks_are_pending_ &=
452 !will_notify_client_that_no_tasks_are_pending; 456 !will_notify_client_that_no_tasks_are_pending;
453 457
454 scheduled_raster_task_count_ = 0; 458 scheduled_raster_task_count_ = 0;
455 if (PendingRasterTaskCount()) 459 if (PendingRasterTaskCount())
456 ScheduleMoreTasks(); 460 ScheduleMoreTasks();
457 461
458 TRACE_EVENT_ASYNC_STEP_INTO1( 462 TRACE_EVENT_ASYNC_STEP_INTO1(
459 "cc", "ScheduledTasks", this, StateName(), "state", StateAsValue()); 463 "cc",
464 "ScheduledTasks",
465 this,
466 StateName(),
467 "state",
468 TracedValue::FromValue(StateAsValue().release()));
460 469
461 // Schedule another check for completed raster tasks while there are 470 // Schedule another check for completed raster tasks while there are
462 // pending raster tasks or pending uploads. 471 // pending raster tasks or pending uploads.
463 if (HasPendingTasks()) 472 if (HasPendingTasks())
464 check_for_completed_raster_task_notifier_.Schedule(); 473 check_for_completed_raster_task_notifier_.Schedule();
465 474
466 // Generate client notifications. 475 // Generate client notifications.
467 if (will_notify_client_that_no_tasks_required_for_activation_are_pending) { 476 if (will_notify_client_that_no_tasks_required_for_activation_are_pending) {
468 DCHECK(!HasPendingTasksRequiredForActivation()); 477 DCHECK(!HasPendingTasksRequiredForActivation());
469 client_->DidFinishRunningTasksRequiredForActivation(); 478 client_->DidFinishRunningTasksRequiredForActivation();
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 resource_provider_->BeginSetPixels(raster_task->resource()->id()); 735 resource_provider_->BeginSetPixels(raster_task->resource()->id());
727 has_performed_uploads_since_last_flush_ = true; 736 has_performed_uploads_since_last_flush_ = true;
728 737
729 bytes_pending_upload_ += raster_task->resource()->bytes(); 738 bytes_pending_upload_ += raster_task->resource()->bytes();
730 raster_tasks_with_pending_upload_.push_back(raster_task); 739 raster_tasks_with_pending_upload_.push_back(raster_task);
731 state.type = RasterTaskState::UPLOADING; 740 state.type = RasterTaskState::UPLOADING;
732 } 741 }
733 completed_tasks_.clear(); 742 completed_tasks_.clear();
734 } 743 }
735 744
736 scoped_refptr<base::debug::ConvertableToTraceFormat> 745 scoped_ptr<base::Value> PixelBufferRasterWorkerPool::StateAsValue() const {
737 PixelBufferRasterWorkerPool::StateAsValue() const { 746 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue);
738 scoped_refptr<base::debug::TracedValue> state = 747
739 new base::debug::TracedValue();
740 state->SetInteger("completed_count", completed_raster_tasks_.size()); 748 state->SetInteger("completed_count", completed_raster_tasks_.size());
741 state->SetInteger("pending_count", raster_task_states_.size()); 749 state->SetInteger("pending_count", raster_task_states_.size());
742 state->SetInteger("pending_upload_count", 750 state->SetInteger("pending_upload_count",
743 raster_tasks_with_pending_upload_.size()); 751 raster_tasks_with_pending_upload_.size());
744 state->SetInteger("pending_required_for_activation_count", 752 state->SetInteger("pending_required_for_activation_count",
745 raster_tasks_required_for_activation_count_); 753 raster_tasks_required_for_activation_count_);
746 state->BeginDictionary("throttle_state"); 754 state->Set("throttle_state", ThrottleStateAsValue().release());
747 ThrottleStateAsValueInto(state.get()); 755 return state.PassAs<base::Value>();
748 state->EndDictionary();
749 return state;
750 } 756 }
751 757
752 void PixelBufferRasterWorkerPool::ThrottleStateAsValueInto( 758 scoped_ptr<base::Value> PixelBufferRasterWorkerPool::ThrottleStateAsValue()
753 base::debug::TracedValue* throttle_state) const { 759 const {
760 scoped_ptr<base::DictionaryValue> throttle_state(new base::DictionaryValue);
761
754 throttle_state->SetInteger("bytes_available_for_upload", 762 throttle_state->SetInteger("bytes_available_for_upload",
755 max_bytes_pending_upload_ - bytes_pending_upload_); 763 max_bytes_pending_upload_ - bytes_pending_upload_);
756 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); 764 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_);
757 throttle_state->SetInteger("scheduled_raster_task_count", 765 throttle_state->SetInteger("scheduled_raster_task_count",
758 scheduled_raster_task_count_); 766 scheduled_raster_task_count_);
767 return throttle_state.PassAs<base::Value>();
759 } 768 }
760 769
761 } // namespace cc 770 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/pixel_buffer_raster_worker_pool.h ('k') | cc/resources/raster_mode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698