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

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

Issue 2703153002: ServiceWorker: ignore AddMessageToConsole before process allocation (Closed)
Patch Set: Created 3 years, 10 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 <utility> 7 #include <utility>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 DCHECK(!step_time_.is_null()); 864 DCHECK(!step_time_.is_null());
865 base::TimeTicks now = base::TimeTicks::Now(); 865 base::TimeTicks now = base::TimeTicks::Now();
866 base::TimeDelta duration = now - step_time_; 866 base::TimeDelta duration = now - step_time_;
867 step_time_ = now; 867 step_time_ = now;
868 return duration; 868 return duration;
869 } 869 }
870 870
871 void EmbeddedWorkerInstance::AddMessageToConsole( 871 void EmbeddedWorkerInstance::AddMessageToConsole(
872 blink::WebConsoleMessage::Level level, 872 blink::WebConsoleMessage::Level level,
873 const std::string& message) { 873 const std::string& message) {
874 if (status_ != EmbeddedWorkerStatus::RUNNING && 874 // Return if EmbeddedWorkerInstance does not have a valid process.
875 status_ != EmbeddedWorkerStatus::STARTING) { 875 if (status() == EmbeddedWorkerStatus::STOPPING ||
876 status() == EmbeddedWorkerStatus::STOPPED ||
877 (status() == EmbeddedWorkerStatus::STARTING &&
878 !HasSentStartWorker(starting_phase()))) {
falken 2017/02/20 08:01:03 can we turn this into a switch statement?
falken 2017/02/20 08:14:45 On second thought, would it be better to just do (
shimazu 2017/02/21 03:13:53 |client_| is valid just after calling Start(), so
shimazu 2017/02/21 03:13:53 Done.
876 return; 879 return;
877 } 880 }
878 DCHECK(client_.is_bound()); 881 DCHECK(client_.is_bound());
879 client_->AddMessageToConsole(level, message); 882 client_->AddMessageToConsole(level, message);
880 } 883 }
881 884
882 // static 885 // static
883 std::string EmbeddedWorkerInstance::StatusToString( 886 std::string EmbeddedWorkerInstance::StatusToString(
884 EmbeddedWorkerStatus status) { 887 EmbeddedWorkerStatus status) {
885 switch (status) { 888 switch (status) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 case SCRIPT_READ_FINISHED: 923 case SCRIPT_READ_FINISHED:
921 return "Script read finished"; 924 return "Script read finished";
922 case STARTING_PHASE_MAX_VALUE: 925 case STARTING_PHASE_MAX_VALUE:
923 NOTREACHED(); 926 NOTREACHED();
924 } 927 }
925 NOTREACHED() << phase; 928 NOTREACHED() << phase;
926 return std::string(); 929 return std::string();
927 } 930 }
928 931
929 } // namespace content 932 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698