Chromium Code Reviews| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
| 10 #include "base/debug/trace_event_synthetic_delay.h" | 10 #include "base/debug/trace_event_synthetic_delay.h" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 base::StringPrintf("CompositorRasterWorker%u", | 40 base::StringPrintf("CompositorRasterWorker%u", |
| 41 static_cast<unsigned>(workers_.size() + 1)) | 41 static_cast<unsigned>(workers_.size() + 1)) |
| 42 .c_str())); | 42 .c_str())); |
| 43 worker->Start(); | 43 worker->Start(); |
| 44 #if defined(OS_ANDROID) || defined(OS_LINUX) | 44 #if defined(OS_ANDROID) || defined(OS_LINUX) |
| 45 worker->SetThreadPriority(base::kThreadPriority_Background); | 45 worker->SetThreadPriority(base::kThreadPriority_Background); |
| 46 #endif | 46 #endif |
| 47 workers_.push_back(worker.Pass()); | 47 workers_.push_back(worker.Pass()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 // Use index 0 for origin thread. | 50 // Use index 0 for origin thread. |
|
reveman
2014/06/20 03:56:29
Please update and move this comment to GetPictureC
| |
| 51 current_tls_.Set(new ThreadLocalState(0)); | 51 current_tls_.Set(new ThreadLocalState(0)); |
|
reveman
2014/06/20 03:56:30
Please remove this now that you handle this below
| |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual ~RasterTaskGraphRunner() { NOTREACHED(); } | 54 virtual ~RasterTaskGraphRunner() { NOTREACHED(); } |
| 55 | 55 |
| 56 size_t GetPictureCloneIndexForCurrentThread() { | 56 size_t GetPictureCloneIndexForCurrentThread() { |
| 57 if (!current_tls_.Get()) | |
| 58 return 0; | |
|
reveman
2014/06/20 03:56:29
How about using a temporary ThreadLocalState* vari
| |
| 57 return current_tls_.Get()->picture_clone_index; | 59 return current_tls_.Get()->picture_clone_index; |
| 58 } | 60 } |
| 59 | 61 |
| 60 private: | 62 private: |
| 61 struct ThreadLocalState { | 63 struct ThreadLocalState { |
| 62 explicit ThreadLocalState(size_t picture_clone_index) | 64 explicit ThreadLocalState(size_t picture_clone_index) |
| 63 : picture_clone_index(picture_clone_index) {} | 65 : picture_clone_index(picture_clone_index) {} |
| 64 | 66 |
| 65 size_t picture_clone_index; | 67 size_t picture_clone_index; |
| 66 }; | 68 }; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 if (decode_it == graph->nodes.end()) | 284 if (decode_it == graph->nodes.end()) |
| 283 InsertNodeForTask(graph, decode_task, priority, 0u); | 285 InsertNodeForTask(graph, decode_task, priority, 0u); |
| 284 | 286 |
| 285 graph->edges.push_back(TaskGraph::Edge(decode_task, raster_task)); | 287 graph->edges.push_back(TaskGraph::Edge(decode_task, raster_task)); |
| 286 } | 288 } |
| 287 | 289 |
| 288 InsertNodeForTask(graph, raster_task, priority, dependencies); | 290 InsertNodeForTask(graph, raster_task, priority, dependencies); |
| 289 } | 291 } |
| 290 | 292 |
| 291 } // namespace cc | 293 } // namespace cc |
| OLD | NEW |