Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: Source/core/workers/WorkerThread.h

Issue 138303002: Add blink::WebWaitableEvent interface (blink side) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: WebVector Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/workers/WorkerThread.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
28 #define WorkerThread_h 28 #define WorkerThread_h
29 29
30 #include "core/frame/ContentSecurityPolicy.h" 30 #include "core/frame/ContentSecurityPolicy.h"
31 #include "core/workers/WorkerRunLoop.h" 31 #include "core/workers/WorkerRunLoop.h"
32 #include "platform/weborigin/SecurityOrigin.h" 32 #include "platform/weborigin/SecurityOrigin.h"
33 #include "wtf/Forward.h" 33 #include "wtf/Forward.h"
34 #include "wtf/OwnPtr.h" 34 #include "wtf/OwnPtr.h"
35 #include "wtf/PassRefPtr.h" 35 #include "wtf/PassRefPtr.h"
36 #include "wtf/RefCounted.h" 36 #include "wtf/RefCounted.h"
37 37
38 namespace blink {
39 class WebWaitableEvent;
40 }
41
38 namespace WebCore { 42 namespace WebCore {
39 43
40 class KURL; 44 class KURL;
41 class NotificationClient; 45 class NotificationClient;
42 class WorkerGlobalScope; 46 class WorkerGlobalScope;
43 class WorkerLoaderProxy; 47 class WorkerLoaderProxy;
44 class WorkerReportingProxy; 48 class WorkerReportingProxy;
45 struct WorkerThreadStartupData; 49 struct WorkerThreadStartupData;
46 50
47 enum WorkerThreadStartMode { DontPauseWorkerGlobalScopeOnStart, PauseWorkerG lobalScopeOnStart }; 51 enum WorkerThreadStartMode { DontPauseWorkerGlobalScopeOnStart, PauseWorkerG lobalScopeOnStart };
48 52
49 class WorkerThread : public RefCounted<WorkerThread> { 53 class WorkerThread : public RefCounted<WorkerThread> {
50 public: 54 public:
51 virtual ~WorkerThread(); 55 virtual ~WorkerThread();
52 56
53 bool start(); 57 bool start();
54 void stop(); 58 void stop();
55 59
60 // Can be used to wait for this worker thread to shut down.
61 // (This is signalled on the main thread, so it's assumed to be waited o n the worker context thread)
62 blink::WebWaitableEvent* shutdownEvent() { return m_shutdownEvent.get(); }
63
56 bool isCurrentThread() const; 64 bool isCurrentThread() const;
57 WorkerRunLoop& runLoop() { return m_runLoop; } 65 WorkerRunLoop& runLoop() { return m_runLoop; }
58 WorkerLoaderProxy& workerLoaderProxy() const { return m_workerLoaderProx y; } 66 WorkerLoaderProxy& workerLoaderProxy() const { return m_workerLoaderProx y; }
59 WorkerReportingProxy& workerReportingProxy() const { return m_workerRepo rtingProxy; } 67 WorkerReportingProxy& workerReportingProxy() const { return m_workerRepo rtingProxy; }
60 68
61 // Number of active worker threads. 69 // Number of active worker threads.
62 static unsigned workerThreadCount(); 70 static unsigned workerThreadCount();
63 static void releaseFastMallocFreeMemoryInAllThreads(); 71 static void releaseFastMallocFreeMemoryInAllThreads();
64 72
65 NotificationClient* getNotificationClient() { return m_notificationClien t; } 73 NotificationClient* getNotificationClient() { return m_notificationClien t; }
(...skipping 20 matching lines...) Expand all
86 WorkerRunLoop m_runLoop; 94 WorkerRunLoop m_runLoop;
87 WorkerLoaderProxy& m_workerLoaderProxy; 95 WorkerLoaderProxy& m_workerLoaderProxy;
88 WorkerReportingProxy& m_workerReportingProxy; 96 WorkerReportingProxy& m_workerReportingProxy;
89 97
90 RefPtr<WorkerGlobalScope> m_workerGlobalScope; 98 RefPtr<WorkerGlobalScope> m_workerGlobalScope;
91 Mutex m_threadCreationMutex; 99 Mutex m_threadCreationMutex;
92 100
93 OwnPtr<WorkerThreadStartupData> m_startupData; 101 OwnPtr<WorkerThreadStartupData> m_startupData;
94 102
95 NotificationClient* m_notificationClient; 103 NotificationClient* m_notificationClient;
104
105 // Used to signal thread shutdown.
106 OwnPtr<blink::WebWaitableEvent> m_shutdownEvent;
96 }; 107 };
97 108
98 } // namespace WebCore 109 } // namespace WebCore
99 110
100 #endif // WorkerThread_h 111 #endif // WorkerThread_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/workers/WorkerThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698