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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // Always an integer value. | 38 // Always an integer value. |
39 typedef uintptr_t PlatformThreadId; | 39 typedef uintptr_t PlatformThreadId; |
40 | 40 |
41 // Provides an interface to an embedder-defined thread implementation. | 41 // Provides an interface to an embedder-defined thread implementation. |
42 // | 42 // |
43 // Deleting the thread blocks until all pending, non-delayed tasks have been | 43 // Deleting the thread blocks until all pending, non-delayed tasks have been |
44 // run. | 44 // run. |
45 class BLINK_PLATFORM_EXPORT WebThread { | 45 class BLINK_PLATFORM_EXPORT WebThread { |
46 public: | 46 public: |
| 47 // An IdleTask is passed a deadline in CLOCK_MONOTONIC seconds and is |
| 48 // expected to complete before this deadline. |
| 49 class IdleTask { |
| 50 public: |
| 51 virtual ~IdleTask() { } |
| 52 virtual void run(double deadlineSeconds) = 0; |
| 53 }; |
| 54 |
47 class BLINK_PLATFORM_EXPORT Task { | 55 class BLINK_PLATFORM_EXPORT Task { |
48 public: | 56 public: |
49 virtual ~Task() { } | 57 virtual ~Task() { } |
50 virtual void run() = 0; | 58 virtual void run() = 0; |
51 }; | 59 }; |
52 | 60 |
53 class BLINK_PLATFORM_EXPORT TaskObserver { | 61 class BLINK_PLATFORM_EXPORT TaskObserver { |
54 public: | 62 public: |
55 virtual ~TaskObserver() { } | 63 virtual ~TaskObserver() { } |
56 virtual void willProcessTask() = 0; | 64 virtual void willProcessTask() = 0; |
(...skipping 26 matching lines...) Expand all Loading... |
83 #ifdef INSIDE_BLINK | 91 #ifdef INSIDE_BLINK |
84 // Helpers for posting bound functions as tasks. | 92 // Helpers for posting bound functions as tasks. |
85 void postTask(const WebTraceLocation&, PassOwnPtr<Function<void()>>); | 93 void postTask(const WebTraceLocation&, PassOwnPtr<Function<void()>>); |
86 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<Function<void()>>,
long long delayMs); | 94 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<Function<void()>>,
long long delayMs); |
87 #endif | 95 #endif |
88 }; | 96 }; |
89 | 97 |
90 } // namespace blink | 98 } // namespace blink |
91 | 99 |
92 #endif | 100 #endif |
OLD | NEW |