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

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

Issue 1018863002: compositor-worker: Introduce CompositorWorker. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 5 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 | Annotate | Revision Log
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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 MutexLocker lock(threadSetMutex()); 283 MutexLocker lock(threadSetMutex());
284 ASSERT(workerThreads().contains(this)); 284 ASSERT(workerThreads().contains(this));
285 workerThreads().remove(this); 285 workerThreads().remove(this);
286 } 286 }
287 287
288 void WorkerThread::start() 288 void WorkerThread::start()
289 { 289 {
290 if (m_thread) 290 if (m_thread)
291 return; 291 return;
292 292
293 m_thread = WebThreadSupportingGC::create("WebCore: Worker"); 293 m_thread = createWebThreadSupportingGC();
294 m_thread->postTask(FROM_HERE, new Task(WTF::bind(&WorkerThread::initialize, this))); 294 m_thread->postTask(FROM_HERE, new Task(WTF::bind(&WorkerThread::initialize, this)));
295 } 295 }
296 296
297 void WorkerThread::interruptAndDispatchInspectorCommands() 297 void WorkerThread::interruptAndDispatchInspectorCommands()
298 { 298 {
299 MutexLocker locker(m_workerInspectorControllerMutex); 299 MutexLocker locker(m_workerInspectorControllerMutex);
300 if (m_workerInspectorController) 300 if (m_workerInspectorController)
301 m_workerInspectorController->interruptAndDispatchInspectorCommands(); 301 m_workerInspectorController->interruptAndDispatchInspectorCommands();
302 } 302 }
303 303
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 OwnPtr<CachedMetadataHandler> handler(workerGlobalScope()->createWorkerScrip tCachedMetadataHandler(scriptURL, cachedMetaData.get())); 352 OwnPtr<CachedMetadataHandler> handler(workerGlobalScope()->createWorkerScrip tCachedMetadataHandler(scriptURL, cachedMetaData.get()));
353 bool success = script->evaluate(ScriptSourceCode(sourceCode, scriptURL), nul lptr, handler.get(), v8CacheOptions); 353 bool success = script->evaluate(ScriptSourceCode(sourceCode, scriptURL), nul lptr, handler.get(), v8CacheOptions);
354 m_workerGlobalScope->didEvaluateWorkerScript(); 354 m_workerGlobalScope->didEvaluateWorkerScript();
355 m_workerReportingProxy.didEvaluateWorkerScript(success); 355 m_workerReportingProxy.didEvaluateWorkerScript(success);
356 356
357 postInitialize(); 357 postInitialize();
358 358
359 postDelayedTask(FROM_HERE, createSameThreadTask(&WorkerThread::idleHandler, this), kShortIdleHandlerDelayMs); 359 postDelayedTask(FROM_HERE, createSameThreadTask(&WorkerThread::idleHandler, this), kShortIdleHandlerDelayMs);
360 } 360 }
361 361
362 PassOwnPtr<WebThreadSupportingGC> WorkerThread::createWebThreadSupportingGC()
363 {
364 return WebThreadSupportingGC::create("WebCore: Worker");
365 }
366
362 void WorkerThread::cleanup() 367 void WorkerThread::cleanup()
363 { 368 {
364 // This should be called before we start the shutdown procedure. 369 // This should be called before we start the shutdown procedure.
365 workerReportingProxy().willDestroyWorkerGlobalScope(); 370 workerReportingProxy().willDestroyWorkerGlobalScope();
366 371
367 // The below assignment will destroy the context, which will in turn notify messaging proxy. 372 // The below assignment will destroy the context, which will in turn notify messaging proxy.
368 // We cannot let any objects survive past thread exit, because no other thre ad will run GC or otherwise destroy them. 373 // We cannot let any objects survive past thread exit, because no other thre ad will run GC or otherwise destroy them.
369 // If Oilpan is enabled, we detach of the context/global scope, with the fin al heap cleanup below sweeping it out. 374 // If Oilpan is enabled, we detach of the context/global scope, with the fin al heap cleanup below sweeping it out.
370 #if !ENABLE(OILPAN) 375 #if !ENABLE(OILPAN)
371 ASSERT(m_workerGlobalScope->hasOneRef()); 376 ASSERT(m_workerGlobalScope->hasOneRef());
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); 618 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get());
614 } 619 }
615 620
616 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke rInspectorController) 621 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke rInspectorController)
617 { 622 {
618 MutexLocker locker(m_workerInspectorControllerMutex); 623 MutexLocker locker(m_workerInspectorControllerMutex);
619 m_workerInspectorController = workerInspectorController; 624 m_workerInspectorController = workerInspectorController;
620 } 625 }
621 626
622 } // namespace blink 627 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698