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 15 matching lines...) Expand all Loading... |
26 #define WebThread_h | 26 #define WebThread_h |
27 | 27 |
28 #include "WebCommon.h" | 28 #include "WebCommon.h" |
29 | 29 |
30 namespace blink { | 30 namespace blink { |
31 | 31 |
32 // Provides an interface to an embedder-defined thread implementation. | 32 // Provides an interface to an embedder-defined thread implementation. |
33 // | 33 // |
34 // Deleting the thread blocks until all pending, non-delayed tasks have been | 34 // Deleting the thread blocks until all pending, non-delayed tasks have been |
35 // run. | 35 // run. |
36 class WebThread { | 36 class BLINK_PLATFORM_EXPORT WebThread { |
37 public: | 37 public: |
38 class Task { | 38 class Task { |
39 public: | 39 public: |
40 virtual ~Task() { } | 40 virtual ~Task() { } |
41 virtual void run() = 0; | 41 virtual void run() = 0; |
42 }; | 42 }; |
43 | 43 |
44 class TaskObserver { | 44 class BLINK_PLATFORM_EXPORT TaskObserver { |
45 public: | 45 public: |
46 virtual ~TaskObserver() { } | 46 virtual ~TaskObserver() { } |
47 virtual void willProcessTask() = 0; | 47 virtual void willProcessTask() = 0; |
48 virtual void didProcessTask() = 0; | 48 virtual void didProcessTask() = 0; |
49 }; | 49 }; |
50 | 50 |
51 // postTask() and postDelayedTask() take ownership of the passed Task | 51 // postTask() and postDelayedTask() take ownership of the passed Task |
52 // object. It is safe to invoke postTask() and postDelayedTask() from any | 52 // object. It is safe to invoke postTask() and postDelayedTask() from any |
53 // thread. | 53 // thread. |
54 virtual void postTask(Task*) = 0; | 54 virtual void postTask(Task*) = 0; |
(...skipping 12 matching lines...) Expand all Loading... |
67 // exitRunLoop() runs tasks until there are no tasks available to run, then
returns control to the caller of enterRunLoop(). | 67 // exitRunLoop() runs tasks until there are no tasks available to run, then
returns control to the caller of enterRunLoop(). |
68 // Must be called when the WebThread is running. | 68 // Must be called when the WebThread is running. |
69 virtual void exitRunLoop() = 0; | 69 virtual void exitRunLoop() = 0; |
70 | 70 |
71 virtual ~WebThread() { } | 71 virtual ~WebThread() { } |
72 }; | 72 }; |
73 | 73 |
74 } // namespace blink | 74 } // namespace blink |
75 | 75 |
76 #endif | 76 #endif |
OLD | NEW |