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

Unified Diff: cc/resources/image_copy_raster_worker_pool.cc

Issue 380763002: Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed memory leak found by Linux ASAN Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/image_copy_raster_worker_pool.h ('k') | cc/resources/image_raster_worker_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/image_copy_raster_worker_pool.cc
diff --git a/cc/resources/image_copy_raster_worker_pool.cc b/cc/resources/image_copy_raster_worker_pool.cc
index f3f888495c6ce6df4e87616e7d95a44ee713c5b6..2a9b7f1eaac087729cb005978b5df888e9dbc888 100644
--- a/cc/resources/image_copy_raster_worker_pool.cc
+++ b/cc/resources/image_copy_raster_worker_pool.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/debug/trace_event.h"
+#include "base/debug/trace_event_argument.h"
#include "cc/debug/traced_value.h"
#include "cc/resources/resource_pool.h"
#include "cc/resources/scoped_resource.h"
@@ -141,12 +142,7 @@ void ImageCopyRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
resource_pool_->ReduceResourceUsage();
TRACE_EVENT_ASYNC_STEP_INTO1(
- "cc",
- "ScheduledTasks",
- this,
- "rasterizing",
- "state",
- TracedValue::FromValue(StateAsValue().release()));
+ "cc", "ScheduledTasks", this, "rasterizing", "state", StateAsValue());
}
void ImageCopyRasterWorkerPool::CheckForCompletedTasks() {
@@ -223,12 +219,7 @@ void ImageCopyRasterWorkerPool::OnRasterRequiredForActivationFinished() {
DCHECK(raster_tasks_required_for_activation_pending_);
raster_tasks_required_for_activation_pending_ = false;
TRACE_EVENT_ASYNC_STEP_INTO1(
- "cc",
- "ScheduledTasks",
- this,
- "rasterizing",
- "state",
- TracedValue::FromValue(StateAsValue().release()));
+ "cc", "ScheduledTasks", this, "rasterizing", "state", StateAsValue());
client_->DidFinishRunningTasksRequiredForActivation();
}
@@ -240,19 +231,22 @@ void ImageCopyRasterWorkerPool::FlushCopies() {
has_performed_copy_since_last_flush_ = false;
}
-scoped_ptr<base::Value> ImageCopyRasterWorkerPool::StateAsValue() const {
- scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue);
+scoped_refptr<base::debug::ConvertableToTraceFormat>
+ImageCopyRasterWorkerPool::StateAsValue() const {
+ scoped_refptr<base::debug::TracedValue> state =
+ new base::debug::TracedValue();
state->SetInteger("pending_count", raster_task_states_.size());
state->SetBoolean("tasks_required_for_activation_pending",
raster_tasks_required_for_activation_pending_);
- state->Set("staging_state", StagingStateAsValue().release());
+ state->BeginDictionary("staging_state");
+ StagingStateAsValueInto(state.get());
+ state->EndDictionary();
- return state.PassAs<base::Value>();
+ return state;
}
-scoped_ptr<base::Value> ImageCopyRasterWorkerPool::StagingStateAsValue() const {
- scoped_ptr<base::DictionaryValue> staging_state(new base::DictionaryValue);
-
+void ImageCopyRasterWorkerPool::StagingStateAsValueInto(
+ base::debug::TracedValue* staging_state) const {
staging_state->SetInteger("staging_resource_count",
resource_pool_->total_resource_count());
staging_state->SetInteger("bytes_used_for_staging_resources",
@@ -263,8 +257,6 @@ scoped_ptr<base::Value> ImageCopyRasterWorkerPool::StagingStateAsValue() const {
staging_state->SetInteger("bytes_pending_copy",
resource_pool_->total_memory_usage_bytes() -
resource_pool_->acquired_memory_usage_bytes());
-
- return staging_state.PassAs<base::Value>();
}
} // namespace cc
« no previous file with comments | « cc/resources/image_copy_raster_worker_pool.h ('k') | cc/resources/image_raster_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698