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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 KURL scriptURL = startupData->m_scriptURL; | 444 KURL scriptURL = startupData->m_scriptURL; |
445 String sourceCode = startupData->m_sourceCode; | 445 String sourceCode = startupData->m_sourceCode; |
446 WorkerThreadStartMode startMode = startupData->m_startMode; | 446 WorkerThreadStartMode startMode = startupData->m_startMode; |
447 std::unique_ptr<Vector<char>> cachedMetaData = | 447 std::unique_ptr<Vector<char>> cachedMetaData = |
448 std::move(startupData->m_cachedMetaData); | 448 std::move(startupData->m_cachedMetaData); |
449 V8CacheOptions v8CacheOptions = | 449 V8CacheOptions v8CacheOptions = |
450 startupData->m_workerV8Settings.m_v8CacheOptions; | 450 startupData->m_workerV8Settings.m_v8CacheOptions; |
451 bool heapLimitIncreasedForDebugging = | 451 bool heapLimitIncreasedForDebugging = |
452 startupData->m_workerV8Settings.m_heapLimitMode == | 452 startupData->m_workerV8Settings.m_heapLimitMode == |
453 WorkerV8Settings::HeapLimitMode::IncreasedForDebugging; | 453 WorkerV8Settings::HeapLimitMode::IncreasedForDebugging; |
454 bool inspectorNetworkCapability = startupData->m_inspectorNetworkCapability; | |
455 | 454 |
456 { | 455 { |
457 MutexLocker lock(m_threadStateMutex); | 456 MutexLocker lock(m_threadStateMutex); |
458 | 457 |
459 if (isOwningBackingThread()) | 458 if (isOwningBackingThread()) |
460 workerBackingThread().initialize(); | 459 workerBackingThread().initialize(); |
461 workerBackingThread().backingThread().addTaskObserver(this); | 460 workerBackingThread().backingThread().addTaskObserver(this); |
462 | 461 |
463 // Optimize for memory usage instead of latency for the worker isolate. | 462 // Optimize for memory usage instead of latency for the worker isolate. |
464 isolate()->IsolateInBackgroundNotification(); | 463 isolate()->IsolateInBackgroundNotification(); |
465 | 464 |
466 if (heapLimitIncreasedForDebugging) { | 465 if (heapLimitIncreasedForDebugging) { |
467 isolate()->IncreaseHeapLimitForDebugging(); | 466 isolate()->IncreaseHeapLimitForDebugging(); |
468 } | 467 } |
469 | 468 |
470 m_consoleMessageStorage = new ConsoleMessageStorage(); | 469 m_consoleMessageStorage = new ConsoleMessageStorage(); |
471 m_globalScope = createWorkerGlobalScope(std::move(startupData)); | 470 m_globalScope = createWorkerGlobalScope(std::move(startupData)); |
472 m_workerReportingProxy.didCreateWorkerGlobalScope(globalScope()); | 471 m_workerReportingProxy.didCreateWorkerGlobalScope(globalScope()); |
473 m_workerInspectorController = | 472 m_workerInspectorController = WorkerInspectorController::create(this); |
474 WorkerInspectorController::create(this, inspectorNetworkCapability); | |
475 | 473 |
476 // TODO(nhiroki): Handle a case where the script controller fails to | 474 // TODO(nhiroki): Handle a case where the script controller fails to |
477 // initialize the context. | 475 // initialize the context. |
478 if (globalScope()->scriptController()->initializeContextIfNeeded()) { | 476 if (globalScope()->scriptController()->initializeContextIfNeeded()) { |
479 m_workerReportingProxy.didInitializeWorkerContext(); | 477 m_workerReportingProxy.didInitializeWorkerContext(); |
480 v8::HandleScope handleScope(isolate()); | 478 v8::HandleScope handleScope(isolate()); |
481 Platform::current()->workerContextCreated( | 479 Platform::current()->workerContextCreated( |
482 globalScope()->scriptController()->context()); | 480 globalScope()->scriptController()->context()); |
483 } | 481 } |
484 | 482 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 MutexLocker lock(m_threadStateMutex); | 649 MutexLocker lock(m_threadStateMutex); |
652 return m_requestedToTerminate; | 650 return m_requestedToTerminate; |
653 } | 651 } |
654 | 652 |
655 ExitCode WorkerThread::getExitCodeForTesting() { | 653 ExitCode WorkerThread::getExitCodeForTesting() { |
656 MutexLocker lock(m_threadStateMutex); | 654 MutexLocker lock(m_threadStateMutex); |
657 return m_exitCode; | 655 return m_exitCode; |
658 } | 656 } |
659 | 657 |
660 } // namespace blink | 658 } // namespace blink |
OLD | NEW |