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

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

Issue 191003010: Oilpan: move WorkerThreadStartupData to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/core/workers/WorkerMessagingProxy.cpp ('k') | 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 28 matching lines...) Expand all
39 class WebWaitableEvent; 39 class WebWaitableEvent;
40 } 40 }
41 41
42 namespace WebCore { 42 namespace WebCore {
43 43
44 class KURL; 44 class KURL;
45 class NotificationClient; 45 class NotificationClient;
46 class WorkerGlobalScope; 46 class WorkerGlobalScope;
47 class WorkerLoaderProxy; 47 class WorkerLoaderProxy;
48 class WorkerReportingProxy; 48 class WorkerReportingProxy;
49 struct WorkerThreadStartupData; 49 class WorkerThreadStartupData;
50 50
51 enum WorkerThreadStartMode { DontPauseWorkerGlobalScopeOnStart, PauseWorkerG lobalScopeOnStart }; 51 enum WorkerThreadStartMode { DontPauseWorkerGlobalScopeOnStart, PauseWorkerG lobalScopeOnStart };
52 52
53 class WorkerThread : public RefCounted<WorkerThread> { 53 class WorkerThread : public RefCounted<WorkerThread> {
54 public: 54 public:
55 virtual ~WorkerThread(); 55 virtual ~WorkerThread();
56 56
57 bool start(); 57 bool start();
58 void stop(); 58 void stop();
59 59
60 // Can be used to wait for this worker thread to shut down. 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) 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(); } 62 blink::WebWaitableEvent* shutdownEvent() { return m_shutdownEvent.get(); }
63 63
64 bool isCurrentThread() const; 64 bool isCurrentThread() const;
65 WorkerRunLoop& runLoop() { return m_runLoop; } 65 WorkerRunLoop& runLoop() { return m_runLoop; }
66 WorkerLoaderProxy& workerLoaderProxy() const { return m_workerLoaderProx y; } 66 WorkerLoaderProxy& workerLoaderProxy() const { return m_workerLoaderProx y; }
67 WorkerReportingProxy& workerReportingProxy() const { return m_workerRepo rtingProxy; } 67 WorkerReportingProxy& workerReportingProxy() const { return m_workerRepo rtingProxy; }
68 68
69 // Number of active worker threads. 69 // Number of active worker threads.
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&, PassOwnPtrWillBe RawPtr<WorkerThreadStartupData>);
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 PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScop e(PassOwnPtr<WorkerThreadStartupData>) = 0; 80 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScop e(PassOwnPtrWillBeRawPtr<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 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; 98 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope;
99 Mutex m_threadCreationMutex; 99 Mutex m_threadCreationMutex;
100 100
101 OwnPtr<WorkerThreadStartupData> m_startupData; 101 OwnPtrWillBePersistent<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
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerMessagingProxy.cpp ('k') | Source/core/workers/WorkerThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698