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

Unified Diff: cc/raster_worker.h

Issue 11593030: cc: Add RasterWorkerPool class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/cc.gyp ('k') | cc/raster_worker.cc » ('j') | cc/tile_manager.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/raster_worker.h
diff --git a/cc/raster_worker.h b/cc/raster_worker.h
new file mode 100644
index 0000000000000000000000000000000000000000..8a88fa071ac8c2af287f6485ba36d7f99fed39b9
--- /dev/null
+++ b/cc/raster_worker.h
@@ -0,0 +1,85 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_RASTER_WORKER_H_
+#define CC_RASTER_WORKER_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "base/threading/thread.h"
+#include "cc/rendering_stats.h"
+#include "cc/scoped_ptr_vector.h"
+#include "ui/gfx/rect.h"
+
+namespace skia {
+class LazyPixelRef;
+}
+
+namespace cc {
+class PicturePileImpl;
+
+class RasterWorker {
nduca 2012/12/19 04:46:50 RasterThreadPool? Worker implies that it is only o
reveman 2012/12/27 15:26:58 Right. I made it RasterWorkerPool in latest patch,
+ public:
+ explicit RasterWorker(size_t num_raster_threads);
+ virtual ~RasterWorker();
+
+ static scoped_ptr<RasterWorker> Create(size_t num_raster_threads) {
+ return make_scoped_ptr(new RasterWorker(num_raster_threads));
+ }
+
+ bool IsBusy();
+
+ void PostRasterTaskAndReply(PicturePileImpl* picture_pile,
+ uint8_t* buffer,
+ const gfx::Rect& rect,
+ float contents_scale,
+ const base::Closure& reply);
+ void PostImageDecodingTaskAndReply(skia::LazyPixelRef* pixel_ref,
+ const base::Closure& reply);
+
+ void GetRenderingStats(RenderingStats* stats);
+
+ private:
+ class Thread : public base::Thread {
+ public:
+ Thread(const std::string name);
+ virtual ~Thread();
+
+ int num_pending_tasks() const { return num_pending_tasks_; }
+
+ private:
+ friend class RasterWorker;
+
+ int num_pending_tasks_;
+
+ DISALLOW_COPY_AND_ASSIGN(Thread);
+ };
+
+ class PendingTaskComparator {
+ public:
+ bool operator() (const Thread* a, const Thread* b) const {
+ return a->num_pending_tasks() < b->num_pending_tasks();
+ }
+ };
+
+ typedef base::Callback<void(RenderingStats* stats)> TaskCallback;
+
+ void PostTaskAndReply(const TaskCallback& task, const base::Closure& reply);
+ void RunTaskOnRasterThread(const TaskCallback& task, RenderingStats* stats);
+ void OnTaskCompleted(Thread* thread,
+ RenderingStats* stats,
+ const base::Closure& reply);
+
+ typedef ScopedPtrVector<Thread> ThreadVector;
+ ThreadVector raster_threads_;
+
+ RenderingStats rendering_stats_;
+
+ DISALLOW_COPY_AND_ASSIGN(RasterWorker);
+};
+
+} // namespace cc
+
+#endif // CC_RASTER_WORKER_H_
« no previous file with comments | « cc/cc.gyp ('k') | cc/raster_worker.cc » ('j') | cc/tile_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698