| 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 "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 void EmbeddedWorkerInstance::Start(int64 service_worker_version_id, | 142 void EmbeddedWorkerInstance::Start(int64 service_worker_version_id, |
| 143 const GURL& scope, | 143 const GURL& scope, |
| 144 const GURL& script_url, | 144 const GURL& script_url, |
| 145 const StatusCallback& callback) { | 145 const StatusCallback& callback) { |
| 146 if (!context_) { | 146 if (!context_) { |
| 147 callback.Run(SERVICE_WORKER_ERROR_ABORT); | 147 callback.Run(SERVICE_WORKER_ERROR_ABORT); |
| 148 // |this| may be destroyed by the callback. | 148 // |this| may be destroyed by the callback. |
| 149 return; | 149 return; |
| 150 } | 150 } |
| 151 DCHECK(status_ == STOPPED); | 151 DCHECK(status_ == STOPPED); |
| 152 // TODO(horo): If we will see crashes here, we have to find the root cause of |
| 153 // the invalid version ID. Otherwise change CHECK to DCHECK. |
| 154 CHECK_NE(service_worker_version_id, kInvalidServiceWorkerVersionId); |
| 152 start_timing_ = base::TimeTicks::Now(); | 155 start_timing_ = base::TimeTicks::Now(); |
| 153 status_ = STARTING; | 156 status_ = STARTING; |
| 154 starting_phase_ = ALLOCATING_PROCESS; | 157 starting_phase_ = ALLOCATING_PROCESS; |
| 155 network_accessed_for_script_ = false; | 158 network_accessed_for_script_ = false; |
| 156 service_registry_.reset(new ServiceRegistryImpl()); | 159 service_registry_.reset(new ServiceRegistryImpl()); |
| 157 FOR_EACH_OBSERVER(Listener, listener_list_, OnStarting()); | 160 FOR_EACH_OBSERVER(Listener, listener_list_, OnStarting()); |
| 158 scoped_ptr<EmbeddedWorkerMsg_StartWorker_Params> params( | 161 scoped_ptr<EmbeddedWorkerMsg_StartWorker_Params> params( |
| 159 new EmbeddedWorkerMsg_StartWorker_Params()); | 162 new EmbeddedWorkerMsg_StartWorker_Params()); |
| 160 TRACE_EVENT_ASYNC_BEGIN2("ServiceWorker", | 163 TRACE_EVENT_ASYNC_BEGIN2("ServiceWorker", |
| 161 "EmbeddedWorkerInstance::ProcessAllocate", | 164 "EmbeddedWorkerInstance::ProcessAllocate", |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 case SCRIPT_READ_FINISHED: | 565 case SCRIPT_READ_FINISHED: |
| 563 return "Script read finished"; | 566 return "Script read finished"; |
| 564 case STARTING_PHASE_MAX_VALUE: | 567 case STARTING_PHASE_MAX_VALUE: |
| 565 NOTREACHED(); | 568 NOTREACHED(); |
| 566 } | 569 } |
| 567 NOTREACHED() << phase; | 570 NOTREACHED() << phase; |
| 568 return std::string(); | 571 return std::string(); |
| 569 } | 572 } |
| 570 | 573 |
| 571 } // namespace content | 574 } // namespace content |
| OLD | NEW |