Commit 4e0010a5 authored by Hiroki Nakagawa's avatar Hiroki Nakagawa Committed by Commit Bot

Worker: Rename WorkerReportingProxy::*WorkerScript to ClassicScript for cleanup

For consistency with ModuleScript, this CL renames...
- WillEvaluateWorkerScript to WillEvaluateClassicScript,
- DidEvaluateWorkerScript to DidEvaluateClassicScript, and
- WillEvaluateImportedScript to WillEvaluateImportedClassicScript.


Bug: 680046
Change-Id: I9120f1ed9d3923d901f32801d551a61bafba04ee
Reviewed-on: https://chromium-review.googlesource.com/967627
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544049}
parent dd3337e0
...@@ -924,7 +924,7 @@ void ServiceWorkerContextClient::WorkerContextStarted( ...@@ -924,7 +924,7 @@ void ServiceWorkerContextClient::WorkerContextStarted(
TRACE_EVENT_NESTABLE_ASYNC_BEGIN0("ServiceWorker", "EVALUATE_SCRIPT", this); TRACE_EVENT_NESTABLE_ASYNC_BEGIN0("ServiceWorker", "EVALUATE_SCRIPT", this);
} }
void ServiceWorkerContextClient::DidEvaluateWorkerScript(bool success) { void ServiceWorkerContextClient::DidEvaluateClassicScript(bool success) {
DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); DCHECK(worker_task_runner_->RunsTasksInCurrentSequence());
(*instance_host_)->OnScriptEvaluated(success); (*instance_host_)->OnScriptEvaluated(success);
......
...@@ -132,7 +132,7 @@ class CONTENT_EXPORT ServiceWorkerContextClient ...@@ -132,7 +132,7 @@ class CONTENT_EXPORT ServiceWorkerContextClient
void WorkerScriptLoaded() override; void WorkerScriptLoaded() override;
void WorkerContextStarted( void WorkerContextStarted(
blink::WebServiceWorkerContextProxy* proxy) override; blink::WebServiceWorkerContextProxy* proxy) override;
void DidEvaluateWorkerScript(bool success) override; void DidEvaluateClassicScript(bool success) override;
void DidInitializeWorkerContext(v8::Local<v8::Context> context) override; void DidInitializeWorkerContext(v8::Local<v8::Context> context) override;
void WillDestroyWorkerContext(v8::Local<v8::Context> context) override; void WillDestroyWorkerContext(v8::Local<v8::Context> context) override;
void WorkerContextDestroyed() override; void WorkerContextDestroyed() override;
......
...@@ -287,7 +287,7 @@ TEST_F(ServiceWorkerContextClientTest, DispatchFetchEvent) { ...@@ -287,7 +287,7 @@ TEST_F(ServiceWorkerContextClientTest, DispatchFetchEvent) {
std::unique_ptr<ServiceWorkerContextClient> context_client; std::unique_ptr<ServiceWorkerContextClient> context_client;
context_client = CreateContextClient(&pipes); context_client = CreateContextClient(&pipes);
context_client->WorkerContextStarted(&mock_proxy); context_client->WorkerContextStarted(&mock_proxy);
context_client->DidEvaluateWorkerScript(true /* success */); context_client->DidEvaluateClassicScript(true /* success */);
task_runner()->RunUntilIdle(); task_runner()->RunUntilIdle();
EXPECT_TRUE(mock_proxy.fetch_events().empty()); EXPECT_TRUE(mock_proxy.fetch_events().empty());
...@@ -318,7 +318,7 @@ TEST_F(ServiceWorkerContextClientTest, ...@@ -318,7 +318,7 @@ TEST_F(ServiceWorkerContextClientTest,
CreateContextClient(&pipes); CreateContextClient(&pipes);
MockWebServiceWorkerContextProxy mock_proxy; MockWebServiceWorkerContextProxy mock_proxy;
context_client->WorkerContextStarted(&mock_proxy); context_client->WorkerContextStarted(&mock_proxy);
context_client->DidEvaluateWorkerScript(true /* success */); context_client->DidEvaluateClassicScript(true /* success */);
task_runner()->RunUntilIdle(); task_runner()->RunUntilIdle();
EXPECT_TRUE(mock_proxy.fetch_events().empty()); EXPECT_TRUE(mock_proxy.fetch_events().empty());
...@@ -357,7 +357,7 @@ TEST_F(ServiceWorkerContextClientTest, ...@@ -357,7 +357,7 @@ TEST_F(ServiceWorkerContextClientTest,
CreateContextClient(&pipes); CreateContextClient(&pipes);
MockWebServiceWorkerContextProxy mock_proxy; MockWebServiceWorkerContextProxy mock_proxy;
context_client->WorkerContextStarted(&mock_proxy); context_client->WorkerContextStarted(&mock_proxy);
context_client->DidEvaluateWorkerScript(true /* success */); context_client->DidEvaluateClassicScript(true /* success */);
task_runner()->RunUntilIdle(); task_runner()->RunUntilIdle();
EXPECT_TRUE(mock_proxy.fetch_events().empty()); EXPECT_TRUE(mock_proxy.fetch_events().empty());
...@@ -406,7 +406,7 @@ TEST_F(ServiceWorkerContextClientTest, ...@@ -406,7 +406,7 @@ TEST_F(ServiceWorkerContextClientTest,
CreateContextClient(&pipes); CreateContextClient(&pipes);
MockWebServiceWorkerContextProxy mock_proxy; MockWebServiceWorkerContextProxy mock_proxy;
context_client->WorkerContextStarted(&mock_proxy); context_client->WorkerContextStarted(&mock_proxy);
context_client->DidEvaluateWorkerScript(true /* success */); context_client->DidEvaluateClassicScript(true /* success */);
task_runner()->RunUntilIdle(); task_runner()->RunUntilIdle();
EXPECT_TRUE(mock_proxy.fetch_events().empty()); EXPECT_TRUE(mock_proxy.fetch_events().empty());
bool is_idle = false; bool is_idle = false;
......
...@@ -115,7 +115,7 @@ void DedicatedWorkerObjectProxy::DidCreateWorkerGlobalScope( ...@@ -115,7 +115,7 @@ void DedicatedWorkerObjectProxy::DidCreateWorkerGlobalScope(
worker_global_scope_ = ToWorkerGlobalScope(global_scope); worker_global_scope_ = ToWorkerGlobalScope(global_scope);
} }
void DedicatedWorkerObjectProxy::DidEvaluateWorkerScript(bool success) { void DedicatedWorkerObjectProxy::DidEvaluateClassicScript(bool success) {
PostCrossThreadTask( PostCrossThreadTask(
*GetParentFrameTaskRunners()->Get(TaskType::kUnspecedTimer), FROM_HERE, *GetParentFrameTaskRunners()->Get(TaskType::kUnspecedTimer), FROM_HERE,
CrossThreadBind(&DedicatedWorkerMessagingProxy::DidEvaluateScript, CrossThreadBind(&DedicatedWorkerMessagingProxy::DidEvaluateScript,
......
...@@ -79,7 +79,7 @@ class CORE_EXPORT DedicatedWorkerObjectProxy : public ThreadedObjectProxyBase { ...@@ -79,7 +79,7 @@ class CORE_EXPORT DedicatedWorkerObjectProxy : public ThreadedObjectProxyBase {
std::unique_ptr<SourceLocation>, std::unique_ptr<SourceLocation>,
int exception_id) override; int exception_id) override;
void DidCreateWorkerGlobalScope(WorkerOrWorkletGlobalScope*) override; void DidCreateWorkerGlobalScope(WorkerOrWorkletGlobalScope*) override;
void DidEvaluateWorkerScript(bool success) override; void DidEvaluateClassicScript(bool success) override;
void DidEvaluateModuleScript(bool success) override; void DidEvaluateModuleScript(bool success) override;
void WillDestroyWorkerGlobalScope() override; void WillDestroyWorkerGlobalScope() override;
......
...@@ -35,7 +35,7 @@ class SharedWorkerReportingProxy final ...@@ -35,7 +35,7 @@ class SharedWorkerReportingProxy final
const String& message, const String& message,
SourceLocation*) override; SourceLocation*) override;
void PostMessageToPageInspector(int session_id, const WTF::String&) override; void PostMessageToPageInspector(int session_id, const WTF::String&) override;
void DidEvaluateWorkerScript(bool success) override {} void DidEvaluateClassicScript(bool success) override {}
void DidCloseWorkerGlobalScope() override; void DidCloseWorkerGlobalScope() override;
void WillDestroyWorkerGlobalScope() override {} void WillDestroyWorkerGlobalScope() override {}
void DidTerminateWorkerThread() override; void DidTerminateWorkerThread() override;
......
...@@ -182,7 +182,7 @@ void WorkerGlobalScope::importScripts(const Vector<String>& urls, ...@@ -182,7 +182,7 @@ void WorkerGlobalScope::importScripts(const Vector<String>& urls,
SingleCachedMetadataHandler* handler( SingleCachedMetadataHandler* handler(
CreateWorkerScriptCachedMetadataHandler(complete_url, CreateWorkerScriptCachedMetadataHandler(complete_url,
cached_meta_data.get())); cached_meta_data.get()));
ReportingProxy().WillEvaluateImportedScript( ReportingProxy().WillEvaluateImportedClassicScript(
source_code.length(), cached_meta_data ? cached_meta_data->size() : 0); source_code.length(), cached_meta_data ? cached_meta_data->size() : 0);
ScriptController()->Evaluate( ScriptController()->Evaluate(
ScriptSourceCode(source_code, ScriptSourceLocationType::kUnknown, ScriptSourceCode(source_code, ScriptSourceLocationType::kUnknown,
...@@ -311,14 +311,14 @@ void WorkerGlobalScope::EvaluateClassicScript( ...@@ -311,14 +311,14 @@ void WorkerGlobalScope::EvaluateClassicScript(
CreateWorkerScriptCachedMetadataHandler(script_url, CreateWorkerScriptCachedMetadataHandler(script_url,
cached_meta_data.get()); cached_meta_data.get());
DCHECK(!source_code.IsNull()); DCHECK(!source_code.IsNull());
ReportingProxy().WillEvaluateWorkerScript( ReportingProxy().WillEvaluateClassicScript(
source_code.length(), source_code.length(),
cached_meta_data.get() ? cached_meta_data->size() : 0); cached_meta_data.get() ? cached_meta_data->size() : 0);
bool success = ScriptController()->Evaluate( bool success = ScriptController()->Evaluate(
ScriptSourceCode(source_code, ScriptSourceLocationType::kUnknown, handler, ScriptSourceCode(source_code, ScriptSourceLocationType::kUnknown, handler,
script_url), script_url),
nullptr /* error_event */, v8_cache_options_); nullptr /* error_event */, v8_cache_options_);
ReportingProxy().DidEvaluateWorkerScript(success); ReportingProxy().DidEvaluateClassicScript(success);
} }
void WorkerGlobalScope::ImportModuleScript( void WorkerGlobalScope::ImportModuleScript(
......
...@@ -33,8 +33,6 @@ void WorkerModuleTreeClient::NotifyModuleTreeLoadFinished( ...@@ -33,8 +33,6 @@ void WorkerModuleTreeClient::NotifyModuleTreeLoadFinished(
// algorithm's asynchronous completion, with script being the asynchronous // algorithm's asynchronous completion, with script being the asynchronous
// completion value." ... // completion value." ...
// TODO(nhiroki): Call WorkerReportingProxy::WillEvaluateWorkerScript() or
// something like that (e.g., WillEvaluateModuleScript()).
ScriptValue error = modulator_->ExecuteModule( ScriptValue error = modulator_->ExecuteModule(
module_script, Modulator::CaptureEvalErrorFlag::kReport); module_script, Modulator::CaptureEvalErrorFlag::kReport);
WorkerGlobalScope* global_scope = WorkerGlobalScope* global_scope =
......
...@@ -79,30 +79,24 @@ class CORE_EXPORT WorkerReportingProxy { ...@@ -79,30 +79,24 @@ class CORE_EXPORT WorkerReportingProxy {
// This may block until CSP/ReferrerPolicy are set on the main thread // This may block until CSP/ReferrerPolicy are set on the main thread
// since they are required for script evaluation, which happens soon after // since they are required for script evaluation, which happens soon after
// this function is called. // this function is called.
// Called before WillEvaluateWorkerScript(). // Called before WillEvaluateClassicScript().
virtual void DidLoadInstalledScript( virtual void DidLoadInstalledScript(
const ContentSecurityPolicyResponseHeaders&, const ContentSecurityPolicyResponseHeaders&,
const String& referrer_policy_on_worker_thread) {} const String& referrer_policy_on_worker_thread) {}
// [classic script only] // Invoked when the main classic script is about to be evaluated.
// Invoked when the worker script is about to be evaluated on virtual void WillEvaluateClassicScript(size_t script_size,
// WorkerThread::InitializeOnWorkerThread. size_t cached_metadata_size) {}
virtual void WillEvaluateWorkerScript(size_t script_size,
size_t cached_metadata_size) {} // Invoked when an imported classic script is about to be evaluated.
virtual void WillEvaluateImportedClassicScript(size_t script_size,
// [classic script only] size_t cached_metadata_size) {}
// Invoked when an imported script is about to be evaluated.
virtual void WillEvaluateImportedScript(size_t script_size, // Invoked when the main classic script is evaluated. |success| is true if the
size_t cached_metadata_size) {} // evaluation completed with no uncaught exception.
virtual void DidEvaluateClassicScript(bool success) {}
// [classic script only]
// Invoked when the worker script is evaluated on // Invoked when the main module script is evaluated. |success| is true if the
// WorkerThread::InitializeOnWorkerThread. |success| is true if the evaluation
// completed with no uncaught exception.
virtual void DidEvaluateWorkerScript(bool success) {}
// [module script only]
// Invoked when the module script is evaluated. |success| is true if the
// evaluation completed with no uncaught exception. // evaluation completed with no uncaught exception.
virtual void DidEvaluateModuleScript(bool success) {} virtual void DidEvaluateModuleScript(bool success) {}
......
...@@ -34,17 +34,17 @@ class MockWorkerReportingProxy final : public WorkerReportingProxy { ...@@ -34,17 +34,17 @@ class MockWorkerReportingProxy final : public WorkerReportingProxy {
MOCK_METHOD1(DidCreateWorkerGlobalScope, void(WorkerOrWorkletGlobalScope*)); MOCK_METHOD1(DidCreateWorkerGlobalScope, void(WorkerOrWorkletGlobalScope*));
MOCK_METHOD0(DidInitializeWorkerContext, void()); MOCK_METHOD0(DidInitializeWorkerContext, void());
MOCK_METHOD2(WillEvaluateWorkerScriptMock, MOCK_METHOD2(WillEvaluateClassicScriptMock,
void(size_t scriptSize, size_t cachedMetadataSize)); void(size_t scriptSize, size_t cachedMetadataSize));
MOCK_METHOD1(DidEvaluateWorkerScript, void(bool success)); MOCK_METHOD1(DidEvaluateClassicScript, void(bool success));
MOCK_METHOD0(DidCloseWorkerGlobalScope, void()); MOCK_METHOD0(DidCloseWorkerGlobalScope, void());
MOCK_METHOD0(WillDestroyWorkerGlobalScope, void()); MOCK_METHOD0(WillDestroyWorkerGlobalScope, void());
MOCK_METHOD0(DidTerminateWorkerThread, void()); MOCK_METHOD0(DidTerminateWorkerThread, void());
void WillEvaluateWorkerScript(size_t script_size, void WillEvaluateClassicScript(size_t script_size,
size_t cached_metadata_size) override { size_t cached_metadata_size) override {
script_evaluation_event_.Signal(); script_evaluation_event_.Signal();
WillEvaluateWorkerScriptMock(script_size, cached_metadata_size); WillEvaluateClassicScriptMock(script_size, cached_metadata_size);
} }
void WaitUntilScriptEvaluation() { script_evaluation_event_.Wait(); } void WaitUntilScriptEvaluation() { script_evaluation_event_.Wait(); }
...@@ -108,8 +108,9 @@ class WorkerThreadTest : public ::testing::Test { ...@@ -108,8 +108,9 @@ class WorkerThreadTest : public ::testing::Test {
void ExpectReportingCalls() { void ExpectReportingCalls() {
EXPECT_CALL(*reporting_proxy_, DidCreateWorkerGlobalScope(_)).Times(1); EXPECT_CALL(*reporting_proxy_, DidCreateWorkerGlobalScope(_)).Times(1);
EXPECT_CALL(*reporting_proxy_, DidInitializeWorkerContext()).Times(1); EXPECT_CALL(*reporting_proxy_, DidInitializeWorkerContext()).Times(1);
EXPECT_CALL(*reporting_proxy_, WillEvaluateWorkerScriptMock(_, _)).Times(1); EXPECT_CALL(*reporting_proxy_, WillEvaluateClassicScriptMock(_, _))
EXPECT_CALL(*reporting_proxy_, DidEvaluateWorkerScript(true)).Times(1); .Times(1);
EXPECT_CALL(*reporting_proxy_, DidEvaluateClassicScript(true)).Times(1);
EXPECT_CALL(*reporting_proxy_, WillDestroyWorkerGlobalScope()).Times(1); EXPECT_CALL(*reporting_proxy_, WillDestroyWorkerGlobalScope()).Times(1);
EXPECT_CALL(*reporting_proxy_, DidTerminateWorkerThread()).Times(1); EXPECT_CALL(*reporting_proxy_, DidTerminateWorkerThread()).Times(1);
EXPECT_CALL(*lifecycle_observer_, ContextDestroyed(_)).Times(1); EXPECT_CALL(*lifecycle_observer_, ContextDestroyed(_)).Times(1);
...@@ -119,9 +120,10 @@ class WorkerThreadTest : public ::testing::Test { ...@@ -119,9 +120,10 @@ class WorkerThreadTest : public ::testing::Test {
EXPECT_CALL(*reporting_proxy_, DidCreateWorkerGlobalScope(_)).Times(1); EXPECT_CALL(*reporting_proxy_, DidCreateWorkerGlobalScope(_)).Times(1);
EXPECT_CALL(*reporting_proxy_, DidInitializeWorkerContext()) EXPECT_CALL(*reporting_proxy_, DidInitializeWorkerContext())
.Times(AtMost(1)); .Times(AtMost(1));
EXPECT_CALL(*reporting_proxy_, WillEvaluateWorkerScriptMock(_, _)) EXPECT_CALL(*reporting_proxy_, WillEvaluateClassicScriptMock(_, _))
.Times(AtMost(1));
EXPECT_CALL(*reporting_proxy_, DidEvaluateClassicScript(_))
.Times(AtMost(1)); .Times(AtMost(1));
EXPECT_CALL(*reporting_proxy_, DidEvaluateWorkerScript(_)).Times(AtMost(1));
EXPECT_CALL(*reporting_proxy_, WillDestroyWorkerGlobalScope()) EXPECT_CALL(*reporting_proxy_, WillDestroyWorkerGlobalScope())
.Times(AtMost(1)); .Times(AtMost(1));
EXPECT_CALL(*reporting_proxy_, DidTerminateWorkerThread()).Times(1); EXPECT_CALL(*reporting_proxy_, DidTerminateWorkerThread()).Times(1);
...@@ -131,8 +133,9 @@ class WorkerThreadTest : public ::testing::Test { ...@@ -131,8 +133,9 @@ class WorkerThreadTest : public ::testing::Test {
void ExpectReportingCallsForWorkerForciblyTerminated() { void ExpectReportingCallsForWorkerForciblyTerminated() {
EXPECT_CALL(*reporting_proxy_, DidCreateWorkerGlobalScope(_)).Times(1); EXPECT_CALL(*reporting_proxy_, DidCreateWorkerGlobalScope(_)).Times(1);
EXPECT_CALL(*reporting_proxy_, DidInitializeWorkerContext()).Times(1); EXPECT_CALL(*reporting_proxy_, DidInitializeWorkerContext()).Times(1);
EXPECT_CALL(*reporting_proxy_, WillEvaluateWorkerScriptMock(_, _)).Times(1); EXPECT_CALL(*reporting_proxy_, WillEvaluateClassicScriptMock(_, _))
EXPECT_CALL(*reporting_proxy_, DidEvaluateWorkerScript(false)).Times(1); .Times(1);
EXPECT_CALL(*reporting_proxy_, DidEvaluateClassicScript(false)).Times(1);
EXPECT_CALL(*reporting_proxy_, WillDestroyWorkerGlobalScope()).Times(1); EXPECT_CALL(*reporting_proxy_, WillDestroyWorkerGlobalScope()).Times(1);
EXPECT_CALL(*reporting_proxy_, DidTerminateWorkerThread()).Times(1); EXPECT_CALL(*reporting_proxy_, DidTerminateWorkerThread()).Times(1);
EXPECT_CALL(*lifecycle_observer_, ContextDestroyed(_)).Times(1); EXPECT_CALL(*lifecycle_observer_, ContextDestroyed(_)).Times(1);
......
...@@ -54,8 +54,6 @@ void WorkletModuleTreeClient::NotifyModuleTreeLoadFinished( ...@@ -54,8 +54,6 @@ void WorkletModuleTreeClient::NotifyModuleTreeLoadFinished(
return; return;
} }
// TODO(nhiroki): Call WorkerReportingProxy::WillEvaluateWorkerScript() or
// something like that (e.g., WillEvaluateModuleScript()).
// Step 4: "Run a module script given script." // Step 4: "Run a module script given script."
ScriptValue error = modulator_->ExecuteModule( ScriptValue error = modulator_->ExecuteModule(
module_script, Modulator::CaptureEvalErrorFlag::kReport); module_script, Modulator::CaptureEvalErrorFlag::kReport);
......
...@@ -117,7 +117,7 @@ void ServiceWorkerGlobalScope::EvaluateClassicScript( ...@@ -117,7 +117,7 @@ void ServiceWorkerGlobalScope::EvaluateClassicScript(
installed_scripts_manager->GetScriptData(script_url, &script_data); installed_scripts_manager->GetScriptData(script_url, &script_data);
if (status == InstalledScriptsManager::ScriptStatus::kFailed) { if (status == InstalledScriptsManager::ScriptStatus::kFailed) {
// This eventually terminates the worker thread. // This eventually terminates the worker thread.
ReportingProxy().DidEvaluateWorkerScript(false); ReportingProxy().DidEvaluateClassicScript(false);
return; return;
} }
...@@ -180,7 +180,7 @@ void ServiceWorkerGlobalScope::RecordScriptSize(size_t script_size, ...@@ -180,7 +180,7 @@ void ServiceWorkerGlobalScope::RecordScriptSize(size_t script_size,
script_cached_metadata_total_size_ += cached_metadata_size; script_cached_metadata_total_size_ += cached_metadata_size;
} }
void ServiceWorkerGlobalScope::DidEvaluateWorkerScript() { void ServiceWorkerGlobalScope::DidEvaluateClassicScript() {
DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, script_count_histogram, DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, script_count_histogram,
("ServiceWorker.ScriptCount", 1, 1000, 50)); ("ServiceWorker.ScriptCount", 1, 1000, 50));
script_count_histogram.Count(script_count_); script_count_histogram.Count(script_count_);
......
...@@ -79,7 +79,7 @@ class MODULES_EXPORT ServiceWorkerGlobalScope final : public WorkerGlobalScope { ...@@ -79,7 +79,7 @@ class MODULES_EXPORT ServiceWorkerGlobalScope final : public WorkerGlobalScope {
void CountImportedScript(size_t script_size, size_t cached_metadata_size); void CountImportedScript(size_t script_size, size_t cached_metadata_size);
// Called when the main worker script is evaluated. // Called when the main worker script is evaluated.
void DidEvaluateWorkerScript(); void DidEvaluateClassicScript();
// ServiceWorkerGlobalScope.idl // ServiceWorkerGlobalScope.idl
ServiceWorkerClients* clients(); ServiceWorkerClients* clients();
......
...@@ -574,24 +574,24 @@ void ServiceWorkerGlobalScopeProxy::DidLoadInstalledScript( ...@@ -574,24 +574,24 @@ void ServiceWorkerGlobalScopeProxy::DidLoadInstalledScript(
waitable_event.Wait(); waitable_event.Wait();
} }
void ServiceWorkerGlobalScopeProxy::WillEvaluateWorkerScript( void ServiceWorkerGlobalScopeProxy::WillEvaluateClassicScript(
size_t script_size, size_t script_size,
size_t cached_metadata_size) { size_t cached_metadata_size) {
DCHECK(WorkerGlobalScope()->IsContextThread()); DCHECK(WorkerGlobalScope()->IsContextThread());
worker_global_scope_->CountWorkerScript(script_size, cached_metadata_size); worker_global_scope_->CountWorkerScript(script_size, cached_metadata_size);
} }
void ServiceWorkerGlobalScopeProxy::WillEvaluateImportedScript( void ServiceWorkerGlobalScopeProxy::WillEvaluateImportedClassicScript(
size_t script_size, size_t script_size,
size_t cached_metadata_size) { size_t cached_metadata_size) {
DCHECK(WorkerGlobalScope()->IsContextThread()); DCHECK(WorkerGlobalScope()->IsContextThread());
worker_global_scope_->CountImportedScript(script_size, cached_metadata_size); worker_global_scope_->CountImportedScript(script_size, cached_metadata_size);
} }
void ServiceWorkerGlobalScopeProxy::DidEvaluateWorkerScript(bool success) { void ServiceWorkerGlobalScopeProxy::DidEvaluateClassicScript(bool success) {
DCHECK(WorkerGlobalScope()->IsContextThread()); DCHECK(WorkerGlobalScope()->IsContextThread());
WorkerGlobalScope()->DidEvaluateWorkerScript(); WorkerGlobalScope()->DidEvaluateClassicScript();
Client().DidEvaluateWorkerScript(success); Client().DidEvaluateClassicScript(success);
} }
void ServiceWorkerGlobalScopeProxy::DidCloseWorkerGlobalScope() { void ServiceWorkerGlobalScopeProxy::DidCloseWorkerGlobalScope() {
......
...@@ -153,11 +153,11 @@ class ServiceWorkerGlobalScopeProxy final ...@@ -153,11 +153,11 @@ class ServiceWorkerGlobalScopeProxy final
void DidLoadInstalledScript( void DidLoadInstalledScript(
const ContentSecurityPolicyResponseHeaders&, const ContentSecurityPolicyResponseHeaders&,
const String& referrer_policy_on_worker_thread) override; const String& referrer_policy_on_worker_thread) override;
void WillEvaluateWorkerScript(size_t script_size, void WillEvaluateClassicScript(size_t script_size,
size_t cached_metadata_size) override; size_t cached_metadata_size) override;
void WillEvaluateImportedScript(size_t script_size, void WillEvaluateImportedClassicScript(size_t script_size,
size_t cached_metadata_size) override; size_t cached_metadata_size) override;
void DidEvaluateWorkerScript(bool success) override; void DidEvaluateClassicScript(bool success) override;
void DidCloseWorkerGlobalScope() override; void DidCloseWorkerGlobalScope() override;
void WillDestroyWorkerGlobalScope() override; void WillDestroyWorkerGlobalScope() override;
void DidTerminateWorkerThread() override; void DidTerminateWorkerThread() override;
......
...@@ -36,7 +36,7 @@ class MockServiceWorkerContextClient : public WebServiceWorkerContextClient { ...@@ -36,7 +36,7 @@ class MockServiceWorkerContextClient : public WebServiceWorkerContextClient {
MOCK_METHOD0(WorkerContextFailedToStart, void()); MOCK_METHOD0(WorkerContextFailedToStart, void());
MOCK_METHOD0(WorkerScriptLoaded, void()); MOCK_METHOD0(WorkerScriptLoaded, void());
void DidEvaluateWorkerScript(bool /* success */) override { void DidEvaluateClassicScript(bool /* success */) override {
script_evaluated_event_.Signal(); script_evaluated_event_.Signal();
} }
......
...@@ -116,7 +116,7 @@ class WebServiceWorkerContextClient { ...@@ -116,7 +116,7 @@ class WebServiceWorkerContextClient {
// Called when initial script evaluation finished. |success| is true if the // Called when initial script evaluation finished. |success| is true if the
// evaluation completed with no uncaught exception. // evaluation completed with no uncaught exception.
virtual void DidEvaluateWorkerScript(bool success) {} virtual void DidEvaluateClassicScript(bool success) {}
// Called when the worker context is initialized. This is probably called // Called when the worker context is initialized. This is probably called
// after WorkerContextStarted(). (WorkerThread::InitializeOnWorkerThread() // after WorkerContextStarted(). (WorkerThread::InitializeOnWorkerThread()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment