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/tile_task_worker_pool.h" | 5 #include "cc/resources/tile_task_worker_pool.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/threading/simple_thread.h" | 11 #include "base/threading/simple_thread.h" |
12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
13 #include "cc/base/scoped_ptr_deque.h" | 13 #include "cc/base/scoped_ptr_deque.h" |
14 #include "cc/resources/raster_source.h" | 14 #include "cc/resources/raster_source.h" |
15 #include "skia/ext/refptr.h" | 15 #include "skia/ext/refptr.h" |
16 #include "third_party/skia/include/core/SkCanvas.h" | 16 #include "third_party/skia/include/core/SkCanvas.h" |
17 #include "third_party/skia/include/core/SkSurface.h" | 17 #include "third_party/skia/include/core/SkSurface.h" |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 namespace { | 20 namespace { |
21 | 21 |
22 base::ThreadPriority g_worker_thread_priority = base::kThreadPriority_Normal; | 22 base::ThreadPriority g_worker_thread_priority = base::ThreadPriority::NORMAL; |
23 | 23 |
24 class TileTaskGraphRunner : public TaskGraphRunner, | 24 class TileTaskGraphRunner : public TaskGraphRunner, |
25 public base::DelegateSimpleThread::Delegate { | 25 public base::DelegateSimpleThread::Delegate { |
26 public: | 26 public: |
27 TileTaskGraphRunner() { | 27 TileTaskGraphRunner() { |
28 size_t num_threads = TileTaskWorkerPool::GetNumWorkerThreads(); | 28 size_t num_threads = TileTaskWorkerPool::GetNumWorkerThreads(); |
29 while (workers_.size() < num_threads) { | 29 while (workers_.size() < num_threads) { |
30 scoped_ptr<base::DelegateSimpleThread> worker = | 30 scoped_ptr<base::DelegateSimpleThread> worker = |
31 make_scoped_ptr(new base::DelegateSimpleThread( | 31 make_scoped_ptr(new base::DelegateSimpleThread( |
32 this, base::StringPrintf( | 32 this, base::StringPrintf( |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the | 263 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the |
264 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728 | 264 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728 |
265 // is fixed. | 265 // is fixed. |
266 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes()); | 266 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes()); |
267 DCHECK_EQ(0u, dst_row_bytes % 4); | 267 DCHECK_EQ(0u, dst_row_bytes % 4); |
268 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0); | 268 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0); |
269 DCHECK_EQ(true, success); | 269 DCHECK_EQ(true, success); |
270 } | 270 } |
271 | 271 |
272 } // namespace cc | 272 } // namespace cc |
OLD | NEW |