| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/renderer/service_worker/service_worker_context_client.h" | 5 #include "content/renderer/service_worker/service_worker_context_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 // (while we're still on the worker thread). | 465 // (while we're still on the worker thread). |
| 466 proxy_ = NULL; | 466 proxy_ = NULL; |
| 467 | 467 |
| 468 // Aborts the all pending sync event callbacks. | 468 // Aborts the all pending sync event callbacks. |
| 469 for (WorkerContextData::SyncEventCallbacksMap::iterator it( | 469 for (WorkerContextData::SyncEventCallbacksMap::iterator it( |
| 470 &context_->sync_event_callbacks); | 470 &context_->sync_event_callbacks); |
| 471 !it.IsAtEnd(); it.Advance()) { | 471 !it.IsAtEnd(); it.Advance()) { |
| 472 it.GetCurrentValue()->Run(blink::mojom::ServiceWorkerEventStatus::ABORTED, | 472 it.GetCurrentValue()->Run(blink::mojom::ServiceWorkerEventStatus::ABORTED, |
| 473 base::Time::Now()); | 473 base::Time::Now()); |
| 474 } | 474 } |
| 475 // Aborts the all pending fetch event callbacks. |
| 476 for (WorkerContextData::FetchEventCallbacksMap::iterator it( |
| 477 &context_->fetch_event_callbacks); |
| 478 !it.IsAtEnd(); it.Advance()) { |
| 479 it.GetCurrentValue()->Run(SERVICE_WORKER_ERROR_ABORT, base::Time::Now()); |
| 480 } |
| 475 | 481 |
| 476 // We have to clear callbacks now, as they need to be freed on the | 482 // We have to clear callbacks now, as they need to be freed on the |
| 477 // same thread. | 483 // same thread. |
| 478 context_.reset(); | 484 context_.reset(); |
| 479 | 485 |
| 480 // This also lets the message filter stop dispatching messages to | 486 // This also lets the message filter stop dispatching messages to |
| 481 // this client. | 487 // this client. |
| 482 g_worker_client_tls.Pointer()->Set(NULL); | 488 g_worker_client_tls.Pointer()->Set(NULL); |
| 483 | 489 |
| 484 GetContentClient()->renderer()->WillDestroyServiceWorkerContextOnWorkerThread( | 490 GetContentClient()->renderer()->WillDestroyServiceWorkerContextOnWorkerThread( |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 } | 1118 } |
| 1113 | 1119 |
| 1114 base::WeakPtr<ServiceWorkerContextClient> | 1120 base::WeakPtr<ServiceWorkerContextClient> |
| 1115 ServiceWorkerContextClient::GetWeakPtr() { | 1121 ServiceWorkerContextClient::GetWeakPtr() { |
| 1116 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1122 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
| 1117 DCHECK(context_); | 1123 DCHECK(context_); |
| 1118 return context_->weak_factory.GetWeakPtr(); | 1124 return context_->weak_factory.GetWeakPtr(); |
| 1119 } | 1125 } |
| 1120 | 1126 |
| 1121 } // namespace content | 1127 } // namespace content |
| OLD | NEW |