| 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/browser/service_worker/service_worker_client_utils.h" | 5 #include "content/browser/service_worker/service_worker_client_utils.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 | 9 |
| 10 #include "base/location.h" |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "content/browser/frame_host/frame_tree_node.h" | 15 #include "content/browser/frame_host/frame_tree_node.h" |
| 13 #include "content/browser/frame_host/render_frame_host_impl.h" | 16 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 14 #include "content/browser/service_worker/service_worker_context_core.h" | 17 #include "content/browser/service_worker/service_worker_context_core.h" |
| 15 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 18 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 16 #include "content/browser/service_worker/service_worker_provider_host.h" | 19 #include "content/browser/service_worker/service_worker_provider_host.h" |
| 17 #include "content/browser/service_worker/service_worker_version.h" | 20 #include "content/browser/service_worker/service_worker_version.h" |
| 18 #include "content/browser/storage_partition_impl.h" | 21 #include "content/browser/storage_partition_impl.h" |
| 19 #include "content/browser/web_contents/web_contents_impl.h" | 22 #include "content/browser/web_contents/web_contents_impl.h" |
| 20 #include "content/common/service_worker/service_worker_client_info.h" | 23 #include "content/common/service_worker/service_worker_client_info.h" |
| 21 #include "content/common/service_worker/service_worker_types.h" | 24 #include "content/common/service_worker/service_worker_types.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 void RunCallback(int render_process_id, int render_frame_id) { | 83 void RunCallback(int render_process_id, int render_frame_id) { |
| 81 // After running the callback, |this| will stop observing, thus | 84 // After running the callback, |this| will stop observing, thus |
| 82 // web_contents() should return nullptr and |RunCallback| should no longer | 85 // web_contents() should return nullptr and |RunCallback| should no longer |
| 83 // be called. Then, |this| will self destroy. | 86 // be called. Then, |this| will self destroy. |
| 84 DCHECK(web_contents()); | 87 DCHECK(web_contents()); |
| 85 | 88 |
| 86 BrowserThread::PostTask( | 89 BrowserThread::PostTask( |
| 87 BrowserThread::IO, FROM_HERE, | 90 BrowserThread::IO, FROM_HERE, |
| 88 base::Bind(callback_, render_process_id, render_frame_id)); | 91 base::Bind(callback_, render_process_id, render_frame_id)); |
| 89 Observe(nullptr); | 92 Observe(nullptr); |
| 90 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 93 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
| 91 } | 94 } |
| 92 | 95 |
| 93 int frame_tree_node_id_; | 96 int frame_tree_node_id_; |
| 94 const OpenURLCallback callback_; | 97 const OpenURLCallback callback_; |
| 95 | 98 |
| 96 DISALLOW_COPY_AND_ASSIGN(OpenURLObserver); | 99 DISALLOW_COPY_AND_ASSIGN(OpenURLObserver); |
| 97 }; | 100 }; |
| 98 | 101 |
| 99 ServiceWorkerClientInfo GetWindowClientInfoOnUI( | 102 ServiceWorkerClientInfo GetWindowClientInfoOnUI( |
| 100 int render_process_id, | 103 int render_process_id, |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 GetWindowClients(controller, options, callback); | 491 GetWindowClients(controller, options, callback); |
| 489 return; | 492 return; |
| 490 } | 493 } |
| 491 | 494 |
| 492 GetNonWindowClients(controller, options, &clients); | 495 GetNonWindowClients(controller, options, &clients); |
| 493 DidGetClients(callback, &clients); | 496 DidGetClients(callback, &clients); |
| 494 } | 497 } |
| 495 | 498 |
| 496 } // namespace service_worker_client_utils | 499 } // namespace service_worker_client_utils |
| 497 } // namespace content | 500 } // namespace content |
| OLD | NEW |