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

Side by Side Diff: cc/tiles/tile_task_manager.h

Issue 1910213005: cc: Refactor TileTaskWorkerPool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@task_states
Patch Set: feedback Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « cc/tiles/tile_manager_unittest.cc ('k') | cc/tiles/tile_task_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_TILES_TILE_TASK_MANAGER_H_
6 #define CC_TILES_TILE_TASK_MANAGER_H_
7
8 #include <stddef.h>
9
10 #include "cc/raster/raster_buffer_provider.h"
11 #include "cc/raster/task_graph_runner.h"
12 #include "cc/raster/tile_task.h"
13
14 namespace cc {
15 // This interface provides the wrapper over TaskGraphRunner for scheduling and
16 // collecting tasks. The client can call CheckForCompletedTasks() at any time to
17 // process all completed tasks at the moment that have finished running or
18 // cancelled.
19 class CC_EXPORT TileTaskManager {
20 public:
21 TileTaskManager();
22 virtual ~TileTaskManager();
23
24 // Schedule running of tile tasks in |graph| and all dependencies.
25 // Previously scheduled tasks that are not in |graph| will be canceled unless
26 // already running. Once scheduled, reply callbacks are guaranteed to run for
27 // all tasks even if they later get canceled by another call to
28 // ScheduleTasks().
29 virtual void ScheduleTasks(TaskGraph* graph) = 0;
30
31 // Check for completed tasks and dispatch reply callbacks.
32 virtual void CheckForCompletedTasks() = 0;
33
34 // Shutdown after canceling all previously scheduled tasks. Reply callbacks
35 // are still guaranteed to run when CheckForCompletedTasks() is called.
36 virtual void Shutdown() = 0;
37
38 // Get RasterBufferProvider.
39 virtual RasterBufferProvider* GetRasterBufferProvider() const = 0;
40 };
41
42 class CC_EXPORT TileTaskManagerImpl : public TileTaskManager {
43 public:
44 ~TileTaskManagerImpl() override;
45
46 static std::unique_ptr<TileTaskManagerImpl> Create(
47 std::unique_ptr<RasterBufferProvider> raster_buffer_provider,
48 TaskGraphRunner* task_graph_runner);
49
50 // Overridden from TileTaskManager:
51 void ScheduleTasks(TaskGraph* graph) override;
52 void CheckForCompletedTasks() override;
53 void Shutdown() override;
54 RasterBufferProvider* GetRasterBufferProvider() const override;
55
56 protected:
57 TileTaskManagerImpl(
58 std::unique_ptr<RasterBufferProvider> raster_buffer_provider,
59 TaskGraphRunner* task_graph_runner);
60
61 std::unique_ptr<RasterBufferProvider> raster_buffer_provider_;
62 TaskGraphRunner* task_graph_runner_;
63 const NamespaceToken namespace_token_;
64 Task::Vector completed_tasks_;
65
66 private:
67 DISALLOW_COPY_AND_ASSIGN(TileTaskManagerImpl);
68 };
69
70 } // namespace cc
71
72 #endif // CC_TILES_TILE_TASK_MANAGER_H_
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager_unittest.cc ('k') | cc/tiles/tile_task_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698