OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 static unsigned workerThreadCount(); | 70 static unsigned workerThreadCount(); |
71 static void releaseFastMallocFreeMemoryInAllThreads(); | 71 static void releaseFastMallocFreeMemoryInAllThreads(); |
72 | 72 |
73 NotificationClient* getNotificationClient() { return m_notificationClien
t; } | 73 NotificationClient* getNotificationClient() { return m_notificationClien
t; } |
74 void setNotificationClient(NotificationClient* client) { m_notificationC
lient = client; } | 74 void setNotificationClient(NotificationClient* client) { m_notificationC
lient = client; } |
75 | 75 |
76 protected: | 76 protected: |
77 WorkerThread(WorkerLoaderProxy&, WorkerReportingProxy&, PassOwnPtr<Worke
rThreadStartupData>); | 77 WorkerThread(WorkerLoaderProxy&, WorkerReportingProxy&, PassOwnPtr<Worke
rThreadStartupData>); |
78 | 78 |
79 // Factory method for creating a new worker context for the thread. | 79 // Factory method for creating a new worker context for the thread. |
80 virtual PassRefPtr<WorkerGlobalScope> createWorkerGlobalScope(PassOwnPtr
<WorkerThreadStartupData>) = 0; | 80 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScop
e(PassOwnPtr<WorkerThreadStartupData>) = 0; |
81 | 81 |
82 // Executes the event loop for the worker thread. Derived classes can ov
erride to perform actions before/after entering the event loop. | 82 // Executes the event loop for the worker thread. Derived classes can ov
erride to perform actions before/after entering the event loop. |
83 virtual void runEventLoop(); | 83 virtual void runEventLoop(); |
84 | 84 |
85 WorkerGlobalScope* workerGlobalScope() { return m_workerGlobalScope.get(
); } | 85 WorkerGlobalScope* workerGlobalScope() { return m_workerGlobalScope.get(
); } |
86 | 86 |
87 private: | 87 private: |
88 // Static function executed as the core routine on the new thread. Passe
d a pointer to a WorkerThread object. | 88 // Static function executed as the core routine on the new thread. Passe
d a pointer to a WorkerThread object. |
89 static void workerThreadStart(void*); | 89 static void workerThreadStart(void*); |
90 | 90 |
91 void workerThread(); | 91 void workerThread(); |
92 | 92 |
93 ThreadIdentifier m_threadID; | 93 ThreadIdentifier m_threadID; |
94 WorkerRunLoop m_runLoop; | 94 WorkerRunLoop m_runLoop; |
95 WorkerLoaderProxy& m_workerLoaderProxy; | 95 WorkerLoaderProxy& m_workerLoaderProxy; |
96 WorkerReportingProxy& m_workerReportingProxy; | 96 WorkerReportingProxy& m_workerReportingProxy; |
97 | 97 |
98 RefPtr<WorkerGlobalScope> m_workerGlobalScope; | 98 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; |
99 Mutex m_threadCreationMutex; | 99 Mutex m_threadCreationMutex; |
100 | 100 |
101 OwnPtr<WorkerThreadStartupData> m_startupData; | 101 OwnPtr<WorkerThreadStartupData> m_startupData; |
102 | 102 |
103 NotificationClient* m_notificationClient; | 103 NotificationClient* m_notificationClient; |
104 | 104 |
105 // Used to signal thread shutdown. | 105 // Used to signal thread shutdown. |
106 OwnPtr<blink::WebWaitableEvent> m_shutdownEvent; | 106 OwnPtr<blink::WebWaitableEvent> m_shutdownEvent; |
107 }; | 107 }; |
108 | 108 |
109 } // namespace WebCore | 109 } // namespace WebCore |
110 | 110 |
111 #endif // WorkerThread_h | 111 #endif // WorkerThread_h |
OLD | NEW |