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

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

Issue 83183005: Add synthetic delay points for latency testing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/trees/thread_proxy.cc » ('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/raster_worker_pool.h" 5 #include "cc/resources/raster_worker_pool.h"
6 6
7 #include "base/debug/trace_event_synthetic_delay.h"
7 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
8 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
9 #include "base/values.h" 10 #include "base/values.h"
10 #include "cc/debug/devtools_instrumentation.h" 11 #include "cc/debug/devtools_instrumentation.h"
11 #include "cc/debug/traced_value.h" 12 #include "cc/debug/traced_value.h"
12 #include "cc/resources/picture_pile_impl.h" 13 #include "cc/resources/picture_pile_impl.h"
13 #include "skia/ext/lazy_pixel_ref.h" 14 #include "skia/ext/lazy_pixel_ref.h"
14 #include "skia/ext/paint_simplifier.h" 15 #include "skia/ext/paint_simplifier.h"
15 #include "third_party/skia/include/core/SkBitmap.h" 16 #include "third_party/skia/include/core/SkBitmap.h"
16 17
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 bool RunRasterOnThread(unsigned thread_index, 101 bool RunRasterOnThread(unsigned thread_index,
101 void* buffer, 102 void* buffer,
102 gfx::Size size, 103 gfx::Size size,
103 int stride) { 104 int stride) {
104 TRACE_EVENT2( 105 TRACE_EVENT2(
105 "cc", "RasterWorkerPoolTaskImpl::RunRasterOnThread", 106 "cc", "RasterWorkerPoolTaskImpl::RunRasterOnThread",
106 "data", 107 "data",
107 TracedValue::FromValue(DataAsValue().release()), 108 TracedValue::FromValue(DataAsValue().release()),
108 "raster_mode", 109 "raster_mode",
109 TracedValue::FromValue(RasterModeAsValue(raster_mode_).release())); 110 TracedValue::FromValue(RasterModeAsValue(raster_mode_).release()));
111 TRACE_EVENT_SYNTHETIC_DELAY_ACTIVATE("cc.RasterRequiredForActivation");
nduca 2013/11/24 19:45:18 so i'm worried about how many traces we've got on
Sami 2013/12/02 14:57:08 Yeah, we should be careful with this stuff in tigh
110 112
111 devtools_instrumentation::ScopedLayerTask raster_task( 113 devtools_instrumentation::ScopedLayerTask raster_task(
112 devtools_instrumentation::kRasterTask, layer_id_); 114 devtools_instrumentation::kRasterTask, layer_id_);
113 115
114 DCHECK(picture_pile_.get()); 116 DCHECK(picture_pile_.get());
115 DCHECK(buffer); 117 DCHECK(buffer);
116 118
117 if (analysis_.is_solid_color) 119 if (analysis_.is_solid_color)
118 return false; 120 return false;
119 121
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 285
284 DISALLOW_COPY_AND_ASSIGN(ImageDecodeWorkerPoolTaskImpl); 286 DISALLOW_COPY_AND_ASSIGN(ImageDecodeWorkerPoolTaskImpl);
285 }; 287 };
286 288
287 class RasterFinishedWorkerPoolTaskImpl : public internal::WorkerPoolTask { 289 class RasterFinishedWorkerPoolTaskImpl : public internal::WorkerPoolTask {
288 public: 290 public:
289 typedef base::Callback<void(const internal::WorkerPoolTask* source)> 291 typedef base::Callback<void(const internal::WorkerPoolTask* source)>
290 Callback; 292 Callback;
291 293
292 RasterFinishedWorkerPoolTaskImpl( 294 RasterFinishedWorkerPoolTaskImpl(
293 const Callback& on_raster_finished_callback) 295 const Callback& on_raster_finished_callback,
296 bool required_for_activation)
294 : origin_loop_(base::MessageLoopProxy::current().get()), 297 : origin_loop_(base::MessageLoopProxy::current().get()),
295 on_raster_finished_callback_(on_raster_finished_callback) { 298 on_raster_finished_callback_(on_raster_finished_callback),
299 required_for_activation_(required_for_activation) {
296 } 300 }
297 301
298 // Overridden from internal::WorkerPoolTask: 302 // Overridden from internal::WorkerPoolTask:
299 virtual void RunOnWorkerThread(unsigned thread_index) OVERRIDE { 303 virtual void RunOnWorkerThread(unsigned thread_index) OVERRIDE {
300 TRACE_EVENT0("cc", "RasterFinishedWorkerPoolTaskImpl::RunOnWorkerThread"); 304 TRACE_EVENT0("cc", "RasterFinishedWorkerPoolTaskImpl::RunOnWorkerThread");
305 if (required_for_activation_)
306 TRACE_EVENT_SYNTHETIC_DELAY_APPLY("cc.RasterRequiredForActivation");
brianderson 2013/11/26 03:14:54 I'm not up-to-date on the lates TileManager code.
Sami 2013/12/02 14:57:08 The way it roughly works is that we first schedule
brianderson 2013/12/03 03:00:30 Ah ok. I see now. I'm assuming the graph is set up
301 origin_loop_->PostTask( 307 origin_loop_->PostTask(
302 FROM_HERE, 308 FROM_HERE,
303 base::Bind(&RasterFinishedWorkerPoolTaskImpl::RunOnOriginThread, 309 base::Bind(&RasterFinishedWorkerPoolTaskImpl::RunOnOriginThread,
304 this)); 310 this));
305 } 311 }
306 virtual void CompleteOnOriginThread() OVERRIDE {} 312 virtual void CompleteOnOriginThread() OVERRIDE {}
307 313
308 private: 314 private:
309 virtual ~RasterFinishedWorkerPoolTaskImpl() {} 315 virtual ~RasterFinishedWorkerPoolTaskImpl() {}
310 316
311 void RunOnOriginThread() const { 317 void RunOnOriginThread() const {
312 on_raster_finished_callback_.Run(this); 318 on_raster_finished_callback_.Run(this);
313 } 319 }
314 320
315 scoped_refptr<base::MessageLoopProxy> origin_loop_; 321 scoped_refptr<base::MessageLoopProxy> origin_loop_;
316 const Callback on_raster_finished_callback_; 322 const Callback on_raster_finished_callback_;
323 const bool required_for_activation_;
317 324
318 DISALLOW_COPY_AND_ASSIGN(RasterFinishedWorkerPoolTaskImpl); 325 DISALLOW_COPY_AND_ASSIGN(RasterFinishedWorkerPoolTaskImpl);
319 }; 326 };
320 327
321 const char* kWorkerThreadNamePrefix = "CompositorRaster"; 328 const char* kWorkerThreadNamePrefix = "CompositorRaster";
322 329
323 } // namespace 330 } // namespace
324 331
325 namespace internal { 332 namespace internal {
326 333
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 return 501 return
495 raster_tasks_required_for_activation_.find(task) != 502 raster_tasks_required_for_activation_.find(task) !=
496 raster_tasks_required_for_activation_.end(); 503 raster_tasks_required_for_activation_.end();
497 } 504 }
498 505
499 scoped_refptr<internal::WorkerPoolTask> 506 scoped_refptr<internal::WorkerPoolTask>
500 RasterWorkerPool::CreateRasterFinishedTask() { 507 RasterWorkerPool::CreateRasterFinishedTask() {
501 return make_scoped_refptr( 508 return make_scoped_refptr(
502 new RasterFinishedWorkerPoolTaskImpl( 509 new RasterFinishedWorkerPoolTaskImpl(
503 base::Bind(&RasterWorkerPool::OnRasterFinished, 510 base::Bind(&RasterWorkerPool::OnRasterFinished,
504 weak_ptr_factory_.GetWeakPtr()))); 511 weak_ptr_factory_.GetWeakPtr()),
512 false));
505 } 513 }
506 514
507 scoped_refptr<internal::WorkerPoolTask> 515 scoped_refptr<internal::WorkerPoolTask>
508 RasterWorkerPool::CreateRasterRequiredForActivationFinishedTask() { 516 RasterWorkerPool::CreateRasterRequiredForActivationFinishedTask() {
509 return make_scoped_refptr( 517 return make_scoped_refptr(
510 new RasterFinishedWorkerPoolTaskImpl( 518 new RasterFinishedWorkerPoolTaskImpl(
511 base::Bind(&RasterWorkerPool::OnRasterRequiredForActivationFinished, 519 base::Bind(&RasterWorkerPool::OnRasterRequiredForActivationFinished,
512 weak_ptr_factory_.GetWeakPtr()))); 520 weak_ptr_factory_.GetWeakPtr()),
521 true));
513 } 522 }
514 523
515 void RasterWorkerPool::OnRasterFinished( 524 void RasterWorkerPool::OnRasterFinished(
516 const internal::WorkerPoolTask* source) { 525 const internal::WorkerPoolTask* source) {
517 TRACE_EVENT0("cc", "RasterWorkerPool::OnRasterFinished"); 526 TRACE_EVENT0("cc", "RasterWorkerPool::OnRasterFinished");
518 527
519 // Early out if current |raster_finished_task_| is not the source. 528 // Early out if current |raster_finished_task_| is not the source.
520 if (source != raster_finished_task_.get()) 529 if (source != raster_finished_task_.get())
521 return; 530 return;
522 531
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 595
587 internal::GraphNode* decode_node = CreateGraphNodeForTask( 596 internal::GraphNode* decode_node = CreateGraphNodeForTask(
588 decode_task, priority, graph); 597 decode_task, priority, graph);
589 decode_node->add_dependent(raster_node); 598 decode_node->add_dependent(raster_node);
590 } 599 }
591 600
592 return raster_node; 601 return raster_node;
593 } 602 }
594 603
595 } // namespace cc 604 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698