| 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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 | 802 |
| 803 base::TimeDelta EmbeddedWorkerInstance::UpdateStepTime() { | 803 base::TimeDelta EmbeddedWorkerInstance::UpdateStepTime() { |
| 804 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 804 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 805 DCHECK(!step_time_.is_null()); | 805 DCHECK(!step_time_.is_null()); |
| 806 base::TimeTicks now = base::TimeTicks::Now(); | 806 base::TimeTicks now = base::TimeTicks::Now(); |
| 807 base::TimeDelta duration = now - step_time_; | 807 base::TimeDelta duration = now - step_time_; |
| 808 step_time_ = now; | 808 step_time_ = now; |
| 809 return duration; | 809 return duration; |
| 810 } | 810 } |
| 811 | 811 |
| 812 void EmbeddedWorkerInstance::AddMessageToConsole(ConsoleMessageLevel level, |
| 813 const std::string& message) { |
| 814 if (status_ != RUNNING && status_ != STARTING) |
| 815 return; |
| 816 registry_->Send(process_id(), new EmbeddedWorkerMsg_AddMessageToConsole( |
| 817 embedded_worker_id_, level, message)); |
| 818 } |
| 819 |
| 812 // static | 820 // static |
| 813 std::string EmbeddedWorkerInstance::StatusToString(Status status) { | 821 std::string EmbeddedWorkerInstance::StatusToString(Status status) { |
| 814 switch (status) { | 822 switch (status) { |
| 815 case STOPPED: | 823 case STOPPED: |
| 816 return "STOPPED"; | 824 return "STOPPED"; |
| 817 case STARTING: | 825 case STARTING: |
| 818 return "STARTING"; | 826 return "STARTING"; |
| 819 case RUNNING: | 827 case RUNNING: |
| 820 return "RUNNING"; | 828 return "RUNNING"; |
| 821 case STOPPING: | 829 case STOPPING: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 849 case SCRIPT_READ_FINISHED: | 857 case SCRIPT_READ_FINISHED: |
| 850 return "Script read finished"; | 858 return "Script read finished"; |
| 851 case STARTING_PHASE_MAX_VALUE: | 859 case STARTING_PHASE_MAX_VALUE: |
| 852 NOTREACHED(); | 860 NOTREACHED(); |
| 853 } | 861 } |
| 854 NOTREACHED() << phase; | 862 NOTREACHED() << phase; |
| 855 return std::string(); | 863 return std::string(); |
| 856 } | 864 } |
| 857 | 865 |
| 858 } // namespace content | 866 } // namespace content |
| OLD | NEW |