| 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 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 virtual void run(double deadlineSeconds) = 0; | 54 virtual void run(double deadlineSeconds) = 0; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 class BLINK_PLATFORM_EXPORT TaskObserver { | 57 class BLINK_PLATFORM_EXPORT TaskObserver { |
| 58 public: | 58 public: |
| 59 virtual ~TaskObserver() {} | 59 virtual ~TaskObserver() {} |
| 60 virtual void willProcessTask() = 0; | 60 virtual void willProcessTask() = 0; |
| 61 virtual void didProcessTask() = 0; | 61 virtual void didProcessTask() = 0; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // Returns a WebTaskRunner bound to the underlying scheduler's default task qu
eue. | 64 // Returns a WebTaskRunner bound to the underlying scheduler's default task |
| 65 // queue. |
| 65 virtual WebTaskRunner* getWebTaskRunner() { return nullptr; } | 66 virtual WebTaskRunner* getWebTaskRunner() { return nullptr; } |
| 66 | 67 |
| 67 virtual bool isCurrentThread() const = 0; | 68 virtual bool isCurrentThread() const = 0; |
| 68 virtual PlatformThreadId threadId() const { return 0; } | 69 virtual PlatformThreadId threadId() const { return 0; } |
| 69 | 70 |
| 70 // TaskObserver is an object that receives task notifications from the Message
Loop | 71 // TaskObserver is an object that receives task notifications from the |
| 72 // MessageLoop |
| 71 // NOTE: TaskObserver implementation should be extremely fast! | 73 // NOTE: TaskObserver implementation should be extremely fast! |
| 72 // This API is performance sensitive. Use only if you have a compelling reason
. | 74 // This API is performance sensitive. Use only if you have a compelling |
| 75 // reason. |
| 73 virtual void addTaskObserver(TaskObserver*) {} | 76 virtual void addTaskObserver(TaskObserver*) {} |
| 74 virtual void removeTaskObserver(TaskObserver*) {} | 77 virtual void removeTaskObserver(TaskObserver*) {} |
| 75 | 78 |
| 76 // TaskTimeObserver is an object that receives notifications for | 79 // TaskTimeObserver is an object that receives notifications for |
| 77 // CPU time spent in each top-level MessageLoop task. | 80 // CPU time spent in each top-level MessageLoop task. |
| 78 // NOTE: TaskTimeObserver implementation should be extremely fast! | 81 // NOTE: TaskTimeObserver implementation should be extremely fast! |
| 79 // This API is performance sensitive. Use only if you have a compelling reason
. | 82 // This API is performance sensitive. Use only if you have a compelling |
| 83 // reason. |
| 80 virtual void addTaskTimeObserver(scheduler::TaskTimeObserver*) {} | 84 virtual void addTaskTimeObserver(scheduler::TaskTimeObserver*) {} |
| 81 virtual void removeTaskTimeObserver(scheduler::TaskTimeObserver*) {} | 85 virtual void removeTaskTimeObserver(scheduler::TaskTimeObserver*) {} |
| 82 | 86 |
| 83 // Returns the scheduler associated with the thread. | 87 // Returns the scheduler associated with the thread. |
| 84 virtual WebScheduler* scheduler() const = 0; | 88 virtual WebScheduler* scheduler() const = 0; |
| 85 | 89 |
| 86 virtual ~WebThread() {} | 90 virtual ~WebThread() {} |
| 87 }; | 91 }; |
| 88 | 92 |
| 89 } // namespace blink | 93 } // namespace blink |
| 90 | 94 |
| 91 #endif | 95 #endif |
| OLD | NEW |