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

Side by Side Diff: content/browser/service_worker/embedded_worker_instance.cc

Issue 1063823005: Service Worker: Use more specific errors when StartWorker fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update histograms.xml Created 5 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/embedded_worker_instance.h" 5 #include "content/browser/service_worker/embedded_worker_instance.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 } 347 }
348 thread_id_ = thread_id; 348 thread_id_ = thread_id;
349 FOR_EACH_OBSERVER(Listener, listener_list_, OnScriptLoaded()); 349 FOR_EACH_OBSERVER(Listener, listener_list_, OnScriptLoaded());
350 } 350 }
351 351
352 void EmbeddedWorkerInstance::OnScriptLoadFailed() { 352 void EmbeddedWorkerInstance::OnScriptLoadFailed() {
353 } 353 }
354 354
355 void EmbeddedWorkerInstance::OnScriptEvaluated(bool success) { 355 void EmbeddedWorkerInstance::OnScriptEvaluated(bool success) {
356 starting_phase_ = SCRIPT_EVALUATED; 356 starting_phase_ = SCRIPT_EVALUATED;
357 if (start_callback_.is_null()) {
358 DVLOG(1) << "Received unexpected OnScriptEvaluated message.";
359 return;
360 }
357 if (success && !start_timing_.is_null()) { 361 if (success && !start_timing_.is_null()) {
358 UMA_HISTOGRAM_TIMES("EmbeddedWorkerInstance.ScriptEvaluate", 362 UMA_HISTOGRAM_TIMES("EmbeddedWorkerInstance.ScriptEvaluate",
359 base::TimeTicks::Now() - start_timing_); 363 base::TimeTicks::Now() - start_timing_);
360 } 364 }
361 DCHECK(!start_callback_.is_null());
362 start_callback_.Run(success ? SERVICE_WORKER_OK 365 start_callback_.Run(success ? SERVICE_WORKER_OK
363 : SERVICE_WORKER_ERROR_START_WORKER_FAILED); 366 : SERVICE_WORKER_ERROR_SCRIPT_EVALUATE_FAILED);
364 start_callback_.Reset(); 367 start_callback_.Reset();
365 } 368 }
366 369
367 void EmbeddedWorkerInstance::OnStarted() { 370 void EmbeddedWorkerInstance::OnStarted() {
368 // Stop is requested before OnStarted is sent back from the worker. 371 // Stop is requested before OnStarted is sent back from the worker.
369 if (status_ == STOPPING) 372 if (status_ == STOPPING)
370 return; 373 return;
371 DCHECK(status_ == STARTING); 374 DCHECK(status_ == STARTING);
372 status_ = RUNNING; 375 status_ = RUNNING;
373 FOR_EACH_OBSERVER(Listener, listener_list_, OnStarted()); 376 FOR_EACH_OBSERVER(Listener, listener_list_, OnStarted());
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 case SCRIPT_EVALUATED: 487 case SCRIPT_EVALUATED:
485 return "Script evaluated"; 488 return "Script evaluated";
486 case STARTING_PHASE_MAX_VALUE: 489 case STARTING_PHASE_MAX_VALUE:
487 NOTREACHED(); 490 NOTREACHED();
488 } 491 }
489 NOTREACHED() << phase; 492 NOTREACHED() << phase;
490 return std::string(); 493 return std::string();
491 } 494 }
492 495
493 } // namespace content 496 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/push_messaging/push_messaging_router.cc ('k') | content/browser/service_worker/service_worker_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698