OLD | NEW |
---|---|
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 |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 #ifndef WebThread_h | 25 #ifndef WebThread_h |
26 #define WebThread_h | 26 #define WebThread_h |
27 | 27 |
28 #include "WebCommon.h" | 28 #include "WebCommon.h" |
29 | |
29 #include <stdint.h> | 30 #include <stdint.h> |
30 | 31 |
31 namespace blink { | 32 namespace blink { |
33 namespace scheduler { | |
34 class TaskTimeObserver; | |
35 } | |
36 | |
32 class WebScheduler; | 37 class WebScheduler; |
33 class WebTaskRunner; | 38 class WebTaskRunner; |
34 | 39 |
35 // Always an integer value. | 40 // Always an integer value. |
36 typedef uintptr_t PlatformThreadId; | 41 typedef uintptr_t PlatformThreadId; |
37 | 42 |
38 // Provides an interface to an embedder-defined thread implementation. | 43 // Provides an interface to an embedder-defined thread implementation. |
39 // | 44 // |
40 // Deleting the thread blocks until all pending, non-delayed tasks have been | 45 // Deleting the thread blocks until all pending, non-delayed tasks have been |
41 // run. | 46 // run. |
(...skipping 14 matching lines...) Expand all Loading... | |
56 virtual void didProcessTask() = 0; | 61 virtual void didProcessTask() = 0; |
57 }; | 62 }; |
58 | 63 |
59 | 64 |
60 // Returns a WebTaskRunner bound to the underlying scheduler's default task queue. | 65 // Returns a WebTaskRunner bound to the underlying scheduler's default task queue. |
61 virtual WebTaskRunner* getWebTaskRunner() { return nullptr; } | 66 virtual WebTaskRunner* getWebTaskRunner() { return nullptr; } |
62 | 67 |
63 virtual bool isCurrentThread() const = 0; | 68 virtual bool isCurrentThread() const = 0; |
64 virtual PlatformThreadId threadId() const { return 0; } | 69 virtual PlatformThreadId threadId() const { return 0; } |
65 | 70 |
71 // TaskObserver is an object that receives task notifications from the Messa geLoop | |
72 // NOTE: TaskObserver implementation should be extremely fast! | |
73 // This API is performance sensitive. Use only if you have a compelling reas on. | |
66 virtual void addTaskObserver(TaskObserver*) { } | 74 virtual void addTaskObserver(TaskObserver*) { } |
67 virtual void removeTaskObserver(TaskObserver*) { } | 75 virtual void removeTaskObserver(TaskObserver*) { } |
68 | 76 |
77 // TaskTimeObserver is an object that receives notifications for | |
pfeldman
2016/08/29 17:23:08
Should we instead set the observer to prevent the
panicker
2016/08/29 17:46:23
Sorry, could you elaborate on what you mean by "se
pfeldman
2016/08/29 17:52:54
You are saying here that I need to have a compelli
panicker
2016/08/29 18:01:32
Reflector will also need this imminently as Messag
pfeldman
2016/08/29 18:04:27
Ok, I must say I am not a fan of it (I'd prefer si
| |
78 // CPU time spent in each top-level MessageLoop task. | |
79 // NOTE: TaskTimeObserver implementation should be extremely fast! | |
80 // This API is performance sensitive. Use only if you have a compelling reas on. | |
81 virtual void addTaskTimeObserver(scheduler::TaskTimeObserver*) {} | |
82 virtual void removeTaskTimeObserver(scheduler::TaskTimeObserver*) {} | |
83 | |
69 // Returns the scheduler associated with the thread. | 84 // Returns the scheduler associated with the thread. |
70 virtual WebScheduler* scheduler() const = 0; | 85 virtual WebScheduler* scheduler() const = 0; |
71 | 86 |
72 virtual ~WebThread() { } | 87 virtual ~WebThread() { } |
73 }; | 88 }; |
74 | 89 |
75 } // namespace blink | 90 } // namespace blink |
76 | 91 |
77 #endif | 92 #endif |
OLD | NEW |