OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 28 matching lines...) Expand all Loading... | |
39 #include "core/inspector/WorkerInspectorController.h" | 39 #include "core/inspector/WorkerInspectorController.h" |
40 #include "core/loader/FrameLoadRequest.h" | 40 #include "core/loader/FrameLoadRequest.h" |
41 #include "core/workers/WorkerClients.h" | 41 #include "core/workers/WorkerClients.h" |
42 #include "core/workers/WorkerGlobalScope.h" | 42 #include "core/workers/WorkerGlobalScope.h" |
43 #include "core/workers/WorkerInspectorProxy.h" | 43 #include "core/workers/WorkerInspectorProxy.h" |
44 #include "core/workers/WorkerLoaderProxy.h" | 44 #include "core/workers/WorkerLoaderProxy.h" |
45 #include "core/workers/WorkerScriptLoader.h" | 45 #include "core/workers/WorkerScriptLoader.h" |
46 #include "core/workers/WorkerThreadStartupData.h" | 46 #include "core/workers/WorkerThreadStartupData.h" |
47 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" | 47 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" |
48 #include "modules/serviceworkers/ServiceWorkerThread.h" | 48 #include "modules/serviceworkers/ServiceWorkerThread.h" |
49 #include "platform/Histogram.h" | |
49 #include "platform/SharedBuffer.h" | 50 #include "platform/SharedBuffer.h" |
50 #include "platform/heap/Handle.h" | 51 #include "platform/heap/Handle.h" |
51 #include "platform/network/ContentSecurityPolicyParsers.h" | 52 #include "platform/network/ContentSecurityPolicyParsers.h" |
52 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" | 53 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" |
53 #include "public/platform/Platform.h" | 54 #include "public/platform/Platform.h" |
54 #include "public/platform/WebURLRequest.h" | 55 #include "public/platform/WebURLRequest.h" |
55 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" | 56 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" |
56 #include "public/web/WebDevToolsAgent.h" | 57 #include "public/web/WebDevToolsAgent.h" |
57 #include "public/web/WebSettings.h" | 58 #include "public/web/WebSettings.h" |
58 #include "public/web/WebView.h" | 59 #include "public/web/WebView.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
306 return; | 307 return; |
307 | 308 |
308 if (m_mainScriptLoader->failed()) { | 309 if (m_mainScriptLoader->failed()) { |
309 m_mainScriptLoader.clear(); | 310 m_mainScriptLoader.clear(); |
310 // This deletes 'this'. | 311 // This deletes 'this'. |
311 m_workerContextClient->workerContextFailedToStart(); | 312 m_workerContextClient->workerContextFailedToStart(); |
312 return; | 313 return; |
313 } | 314 } |
314 m_workerContextClient->workerScriptLoaded(); | 315 m_workerContextClient->workerScriptLoaded(); |
315 | 316 |
316 Platform::current()->histogramCustomCounts("ServiceWorker.ScriptSize", m_mai nScriptLoader->script().length(), 1000, 5000000, 50); | 317 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scriptSizeHistogram, n ew CustomCountHistogram("ServiceWorker.ScriptSize", 1000, 5000000, 50)); |
nhiroki
2016/02/05 00:55:41
This function is called only on the main thread (a
| |
317 if (m_mainScriptLoader->cachedMetadata()) | 318 scriptSizeHistogram.count(m_mainScriptLoader->script().length()); |
318 Platform::current()->histogramCustomCounts("ServiceWorker.ScriptCachedMe tadataSize", m_mainScriptLoader->cachedMetadata()->size(), 1000, 50000000, 50); | 319 if (m_mainScriptLoader->cachedMetadata()) { |
320 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scriptCachedMetada taSizeHistogram, new CustomCountHistogram("ServiceWorker.ScriptCachedMetadataSiz e", 1000, 50000000, 50)); | |
321 scriptCachedMetadataSizeHistogram.count(m_mainScriptLoader->cachedMetada ta()->size()); | |
322 } | |
319 | 323 |
320 startWorkerThread(); | 324 startWorkerThread(); |
321 } | 325 } |
322 | 326 |
323 void WebEmbeddedWorkerImpl::startWorkerThread() | 327 void WebEmbeddedWorkerImpl::startWorkerThread() |
324 { | 328 { |
325 ASSERT(!m_askedToTerminate); | 329 ASSERT(!m_askedToTerminate); |
326 | 330 |
327 Document* document = m_mainFrame->frame()->document(); | 331 Document* document = m_mainFrame->frame()->document(); |
328 | 332 |
(...skipping 27 matching lines...) Expand all Loading... | |
356 m_mainScriptLoader.clear(); | 360 m_mainScriptLoader.clear(); |
357 | 361 |
358 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc ument, *m_workerContextClient); | 362 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc ument, *m_workerContextClient); |
359 m_loaderProxy = WorkerLoaderProxy::create(this); | 363 m_loaderProxy = WorkerLoaderProxy::create(this); |
360 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS copeProxy); | 364 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS copeProxy); |
361 m_workerThread->start(startupData.release()); | 365 m_workerThread->start(startupData.release()); |
362 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), scriptURL); | 366 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), scriptURL); |
363 } | 367 } |
364 | 368 |
365 } // namespace blink | 369 } // namespace blink |
OLD | NEW |