Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 switch (status()) { |
| 876 return; | 876 case EmbeddedWorkerStatus::STOPPING: |
| 877 case EmbeddedWorkerStatus::STOPPED: | |
| 878 return; | |
| 879 case EmbeddedWorkerStatus::STARTING: | |
| 880 if (!HasSentStartWorker(starting_phase())) | |
| 881 return; | |
| 882 break; | |
| 883 case EmbeddedWorkerStatus::RUNNING: | |
| 884 break; | |
|
falken
2017/02/21 04:03:30
Sorry for keeping suggesting things. Would if (pro
shimazu
2017/02/21 04:39:51
process_id() != kInvalidUniqueID seems much better
| |
| 877 } | 885 } |
| 878 DCHECK(client_.is_bound()); | 886 DCHECK(client_.is_bound()); |
| 879 client_->AddMessageToConsole(level, message); | 887 client_->AddMessageToConsole(level, message); |
| 880 } | 888 } |
| 881 | 889 |
| 882 // static | 890 // static |
| 883 std::string EmbeddedWorkerInstance::StatusToString( | 891 std::string EmbeddedWorkerInstance::StatusToString( |
| 884 EmbeddedWorkerStatus status) { | 892 EmbeddedWorkerStatus status) { |
| 885 switch (status) { | 893 switch (status) { |
| 886 case EmbeddedWorkerStatus::STOPPED: | 894 case EmbeddedWorkerStatus::STOPPED: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 920 case SCRIPT_READ_FINISHED: | 928 case SCRIPT_READ_FINISHED: |
| 921 return "Script read finished"; | 929 return "Script read finished"; |
| 922 case STARTING_PHASE_MAX_VALUE: | 930 case STARTING_PHASE_MAX_VALUE: |
| 923 NOTREACHED(); | 931 NOTREACHED(); |
| 924 } | 932 } |
| 925 NOTREACHED() << phase; | 933 NOTREACHED() << phase; |
| 926 return std::string(); | 934 return std::string(); |
| 927 } | 935 } |
| 928 | 936 |
| 929 } // namespace content | 937 } // namespace content |
| OLD | NEW |