| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 10 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 class WorkerActivatedObserver | 150 class WorkerActivatedObserver |
| 151 : public ServiceWorkerContextObserver, | 151 : public ServiceWorkerContextObserver, |
| 152 public base::RefCountedThreadSafe<WorkerActivatedObserver> { | 152 public base::RefCountedThreadSafe<WorkerActivatedObserver> { |
| 153 public: | 153 public: |
| 154 explicit WorkerActivatedObserver(ServiceWorkerContextWrapper* context) | 154 explicit WorkerActivatedObserver(ServiceWorkerContextWrapper* context) |
| 155 : context_(context) {} | 155 : context_(context) {} |
| 156 void Init() { | 156 void Init() { |
| 157 RunOnIOThread(base::Bind(&WorkerActivatedObserver::InitOnIOThread, this)); | 157 RunOnIOThread(base::Bind(&WorkerActivatedObserver::InitOnIOThread, this)); |
| 158 } | 158 } |
| 159 // ServiceWorkerContextObserver overrides. | 159 // ServiceWorkerContextObserver overrides. |
| 160 void OnVersionStateChanged(int64 version_id) override { | 160 void OnVersionStateChanged(int64 version_id, |
| 161 ServiceWorkerVersion::Status) override { |
| 161 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 162 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 162 const ServiceWorkerVersion* version = | 163 const ServiceWorkerVersion* version = |
| 163 context_->context()->GetLiveVersion(version_id); | 164 context_->context()->GetLiveVersion(version_id); |
| 164 if (version->status() == ServiceWorkerVersion::ACTIVATED) { | 165 if (version->status() == ServiceWorkerVersion::ACTIVATED) { |
| 165 context_->RemoveObserver(this); | 166 context_->RemoveObserver(this); |
| 166 BrowserThread::PostTask(BrowserThread::UI, | 167 BrowserThread::PostTask(BrowserThread::UI, |
| 167 FROM_HERE, | 168 FROM_HERE, |
| 168 base::Bind(&WorkerActivatedObserver::Quit, this)); | 169 base::Bind(&WorkerActivatedObserver::Quit, this)); |
| 169 } | 170 } |
| 170 } | 171 } |
| (...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 ASSERT_EQ(SERVICE_WORKER_OK, status); | 1204 ASSERT_EQ(SERVICE_WORKER_OK, status); |
| 1204 // Stop the worker. | 1205 // Stop the worker. |
| 1205 StopWorker(SERVICE_WORKER_OK); | 1206 StopWorker(SERVICE_WORKER_OK); |
| 1206 // Restart the worker. | 1207 // Restart the worker. |
| 1207 StartWorker(SERVICE_WORKER_OK); | 1208 StartWorker(SERVICE_WORKER_OK); |
| 1208 // Stop the worker. | 1209 // Stop the worker. |
| 1209 StopWorker(SERVICE_WORKER_OK); | 1210 StopWorker(SERVICE_WORKER_OK); |
| 1210 } | 1211 } |
| 1211 | 1212 |
| 1212 } // namespace content | 1213 } // namespace content |
| OLD | NEW |