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

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

Issue 1749073002: Do V8 GC ASAP if system memory is pressured (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: send synchronous notification to worker thread Created 4 years, 8 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
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 20 matching lines...) Expand all
31 #include "core/dom/ExecutionContextTask.h" 31 #include "core/dom/ExecutionContextTask.h"
32 #include "core/frame/csp/ContentSecurityPolicy.h" 32 #include "core/frame/csp/ContentSecurityPolicy.h"
33 #include "core/workers/WorkerGlobalScope.h" 33 #include "core/workers/WorkerGlobalScope.h"
34 #include "core/workers/WorkerLoaderProxy.h" 34 #include "core/workers/WorkerLoaderProxy.h"
35 #include "platform/WebThreadSupportingGC.h" 35 #include "platform/WebThreadSupportingGC.h"
36 #include "platform/weborigin/SecurityOrigin.h" 36 #include "platform/weborigin/SecurityOrigin.h"
37 #include "wtf/Forward.h" 37 #include "wtf/Forward.h"
38 #include "wtf/Functional.h" 38 #include "wtf/Functional.h"
39 #include "wtf/OwnPtr.h" 39 #include "wtf/OwnPtr.h"
40 #include "wtf/PassRefPtr.h" 40 #include "wtf/PassRefPtr.h"
41 #include <set>
41 #include <v8.h> 42 #include <v8.h>
42 43
43 namespace blink { 44 namespace blink {
44 45
45 class InspectorTaskRunner; 46 class InspectorTaskRunner;
46 class WaitableEvent; 47 class WaitableEvent;
47 class WorkerGlobalScope; 48 class WorkerGlobalScope;
48 class WorkerInspectorController; 49 class WorkerInspectorController;
49 class WorkerMicrotaskRunner; 50 class WorkerMicrotaskRunner;
50 class WorkerReportingProxy; 51 class WorkerReportingProxy;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 WorkerGlobalScope* workerGlobalScope(); 108 WorkerGlobalScope* workerGlobalScope();
108 109
109 // Returns true once one of the terminate* methods is called. 110 // Returns true once one of the terminate* methods is called.
110 bool terminated(); 111 bool terminated();
111 112
112 // Number of active worker threads. 113 // Number of active worker threads.
113 static unsigned workerThreadCount(); 114 static unsigned workerThreadCount();
114 115
115 PlatformThreadId platformThreadId(); 116 PlatformThreadId platformThreadId();
116 117
118 static std::set<v8::Isolate*>* workerThreadIsolates();
kinuko 2016/04/11 09:30:40 Why we return mutable pointer to the set here?
hong.zheng 2016/04/15 06:05:57 Done.
119
117 protected: 120 protected:
118 WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); 121 WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&);
119 122
120 // Factory method for creating a new worker context for the thread. 123 // Factory method for creating a new worker context for the thread.
121 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa ssOwnPtr<WorkerThreadStartupData>) = 0; 124 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa ssOwnPtr<WorkerThreadStartupData>) = 0;
122 125
123 virtual void postInitialize() { } 126 virtual void postInitialize() { }
124 127
125 // Both of these methods are called in the worker thread. 128 // Both of these methods are called in the worker thread.
126 virtual void initializeBackingThread(); 129 virtual void initializeBackingThread();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 170
168 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; 171 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope;
169 172
170 v8::Isolate* m_isolate; 173 v8::Isolate* m_isolate;
171 174
172 // Used to signal thread shutdown. 175 // Used to signal thread shutdown.
173 OwnPtr<WaitableEvent> m_shutdownEvent; 176 OwnPtr<WaitableEvent> m_shutdownEvent;
174 177
175 // Used to signal thread termination. 178 // Used to signal thread termination.
176 OwnPtr<WaitableEvent> m_terminationEvent; 179 OwnPtr<WaitableEvent> m_terminationEvent;
180
181 static std::set<v8::Isolate*>* gIsolates;
kinuko 2016/04/11 09:30:40 Why do we need to have this in the header?
hong.zheng 2016/04/15 06:05:57 Done.
177 }; 182 };
178 183
179 } // namespace blink 184 } // namespace blink
180 185
181 #endif // WorkerThread_h 186 #endif // WorkerThread_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698