| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TIME_DOMAIN_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TIME_DOMAIN_H_ |
| 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TIME_DOMAIN_H_ | 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TIME_DOMAIN_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // The clock itself is provided by subclasses of the TimeDomain and it may be | 39 // The clock itself is provided by subclasses of the TimeDomain and it may be |
| 40 // the real wall clock or a synthetic (virtual) time base. | 40 // the real wall clock or a synthetic (virtual) time base. |
| 41 class BLINK_PLATFORM_EXPORT TimeDomain { | 41 class BLINK_PLATFORM_EXPORT TimeDomain { |
| 42 public: | 42 public: |
| 43 class BLINK_PLATFORM_EXPORT Observer { | 43 class BLINK_PLATFORM_EXPORT Observer { |
| 44 public: | 44 public: |
| 45 virtual ~Observer() {} | 45 virtual ~Observer() {} |
| 46 | 46 |
| 47 // Called when an empty TaskQueue registered with this TimeDomain has a task | 47 // Called when an empty TaskQueue registered with this TimeDomain has a task |
| 48 // enqueued. | 48 // enqueued. |
| 49 virtual void OnTimeDomainHasImmediateWork() = 0; | 49 // |task_queue| - task queue which has immediate work scheduled. |
| 50 virtual void OnTimeDomainHasImmediateWork(TaskQueue* task_queue) = 0; |
| 50 | 51 |
| 51 // Called when a TaskQueue registered with this TimeDomain has a delayed | 52 // Called when a TaskQueue registered with this TimeDomain has a delayed |
| 52 // task enqueued. | 53 // task enqueued. |
| 53 virtual void OnTimeDomainHasDelayedWork() = 0; | 54 // |task_queue| - task queue which has delayed work scheduled. |
| 55 virtual void OnTimeDomainHasDelayedWork(TaskQueue* task_queue) = 0; |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 explicit TimeDomain(Observer* observer); | 58 explicit TimeDomain(Observer* observer); |
| 57 virtual ~TimeDomain(); | 59 virtual ~TimeDomain(); |
| 58 | 60 |
| 59 // Returns a LazyNow that evaluate this TimeDomain's Now. Can be called from | 61 // Returns a LazyNow that evaluate this TimeDomain's Now. Can be called from |
| 60 // any thread. | 62 // any thread. |
| 61 // TODO(alexclarke): Make this main thread only. | 63 // TODO(alexclarke): Make this main thread only. |
| 62 virtual LazyNow CreateLazyNow() const = 0; | 64 virtual LazyNow CreateLazyNow() const = 0; |
| 63 | 65 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 166 |
| 165 base::ThreadChecker main_thread_checker_; | 167 base::ThreadChecker main_thread_checker_; |
| 166 | 168 |
| 167 DISALLOW_COPY_AND_ASSIGN(TimeDomain); | 169 DISALLOW_COPY_AND_ASSIGN(TimeDomain); |
| 168 }; | 170 }; |
| 169 | 171 |
| 170 } // namespace scheduler | 172 } // namespace scheduler |
| 171 } // namespace blink | 173 } // namespace blink |
| 172 | 174 |
| 173 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TIME_DOMAIN_H_ | 175 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TIME_DOMAIN_H_ |
| OLD | NEW |