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

Side by Side Diff: public/platform/WebThread.h

Issue 1310253009: Introduce WebTaskRunner Patch 5/5 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove the postTask and postDelayedTask too Created 5 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 class BLINK_PLATFORM_EXPORT WebThread { 43 class BLINK_PLATFORM_EXPORT WebThread {
44 public: 44 public:
45 // An IdleTask is passed a deadline in CLOCK_MONOTONIC seconds and is 45 // An IdleTask is passed a deadline in CLOCK_MONOTONIC seconds and is
46 // expected to complete before this deadline. 46 // expected to complete before this deadline.
47 class IdleTask { 47 class IdleTask {
48 public: 48 public:
49 virtual ~IdleTask() { } 49 virtual ~IdleTask() { }
50 virtual void run(double deadlineSeconds) = 0; 50 virtual void run(double deadlineSeconds) = 0;
51 }; 51 };
52 52
53 // TODO(alexclarke): Remove this once it's no longer referenced by chromium.
54 class BLINK_PLATFORM_EXPORT Task {
55 public:
56 virtual ~Task() { }
57 virtual void run() = 0;
58 };
59
60 class BLINK_PLATFORM_EXPORT TaskObserver { 53 class BLINK_PLATFORM_EXPORT TaskObserver {
61 public: 54 public:
62 virtual ~TaskObserver() { } 55 virtual ~TaskObserver() { }
63 virtual void willProcessTask() = 0; 56 virtual void willProcessTask() = 0;
64 virtual void didProcessTask() = 0; 57 virtual void didProcessTask() = 0;
65 }; 58 };
66 59
67 // postTask() and postDelayedTask() take ownership of the passed Task
68 // object. It is safe to invoke postTask() and postDelayedTask() from any
69 // thread.
70 // TODO(alexclarke): Remove postTask & postDelayedTask.
71 virtual void postTask(const WebTraceLocation&, Task*) { }
72 virtual void postDelayedTask(const WebTraceLocation&, Task*, long long delay Ms) { };
73 60
74 // Returns a WebTaskRunner bound to the underlying scheduler's default task queue. 61 // Returns a WebTaskRunner bound to the underlying scheduler's default task queue.
75 virtual WebTaskRunner* taskRunner() { return nullptr; } 62 virtual WebTaskRunner* taskRunner() { return nullptr; }
76 63
77 virtual bool isCurrentThread() const = 0; 64 virtual bool isCurrentThread() const = 0;
78 virtual PlatformThreadId threadId() const { return 0; } 65 virtual PlatformThreadId threadId() const { return 0; }
79 66
80 virtual void addTaskObserver(TaskObserver*) { } 67 virtual void addTaskObserver(TaskObserver*) { }
81 virtual void removeTaskObserver(TaskObserver*) { } 68 virtual void removeTaskObserver(TaskObserver*) { }
82 69
83 // Returns the scheduler associated with the thread. 70 // Returns the scheduler associated with the thread.
84 virtual WebScheduler* scheduler() const = 0; 71 virtual WebScheduler* scheduler() const = 0;
85 72
86 virtual ~WebThread() { } 73 virtual ~WebThread() { }
87 }; 74 };
88 75
89 } // namespace blink 76 } // namespace blink
90 77
91 #endif 78 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698