Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: content/browser/service_worker/service_worker_test_utils.h

Issue 2653493009: Add two interfaces for ServiceWorkerProviderContext/ProviderHost (Closed)
Patch Set: Addressed comments from falken Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "content/common/service_worker/service_worker_provider_interfaces.mojom .h"
14 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
15 #include "content/public/common/content_switches.h" 16 #include "content/public/common/content_switches.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 namespace content { 19 namespace content {
19 20
20 class ServiceWorkerContextCore; 21 class ServiceWorkerContextCore;
21 class ServiceWorkerDispatcherHost; 22 class ServiceWorkerDispatcherHost;
22 class ServiceWorkerProviderHost; 23 class ServiceWorkerProviderHost;
23 24
(...skipping 15 matching lines...) Expand all
39 template <typename Arg> 40 template <typename Arg>
40 base::Callback<void(Arg)> CreateReceiverOnCurrentThread( 41 base::Callback<void(Arg)> CreateReceiverOnCurrentThread(
41 Arg* out, 42 Arg* out,
42 const base::Closure& quit = base::Closure()) { 43 const base::Closure& quit = base::Closure()) {
43 BrowserThread::ID id; 44 BrowserThread::ID id;
44 bool ret = BrowserThread::GetCurrentThreadIdentifier(&id); 45 bool ret = BrowserThread::GetCurrentThreadIdentifier(&id);
45 DCHECK(ret); 46 DCHECK(ret);
46 return base::Bind(&ReceiveResult<Arg>, id, quit, out); 47 return base::Bind(&ReceiveResult<Arg>, id, quit, out);
47 } 48 }
48 49
50 // Container for keeping the Mojo endpoints which should be on the renderer.
falken 2017/05/22 08:28:12 The comment should probably mention "provider" som
shimazu 2017/05/23 06:29:34 Done.
51 // When destroying the pointer or request, its error handler will be called.
falken 2017/05/22 08:28:12 its means "the |client_request|'s" ?
shimazu 2017/05/23 06:29:34 Removed this line because the comment seems duplic
falken 2017/05/23 08:31:49 Acknowledged.
52 struct ServiceWorkerRemoteProviderEndpoint {
53 ServiceWorkerRemoteProviderEndpoint();
54 ServiceWorkerRemoteProviderEndpoint(
55 ServiceWorkerRemoteProviderEndpoint&& other);
56 ~ServiceWorkerRemoteProviderEndpoint();
57
58 // Bound with content::ServiceWorkerProviderHost. The provider host will be
59 // removed asynchronously when this pointer is closed.
60 mojom::ServiceWorkerProviderHostAssociatedPtr host_ptr;
61 // This is the other end of ServiceWorkerProviderAssociatedPtr owned by
62 // ServiceWorkerProviderHost.
falken 2017/05/22 08:28:12 content::ServiceWorkerProviderHost?
shimazu 2017/05/23 06:29:34 Done.
63 mojom::ServiceWorkerProviderAssociatedRequest client_request;
64
65 private:
66 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRemoteProviderEndpoint);
67 };
68
49 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow( 69 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow(
50 int process_id, 70 int process_id,
51 int provider_id, 71 int provider_id,
52 bool is_parent_frame_secure, 72 bool is_parent_frame_secure,
53 base::WeakPtr<ServiceWorkerContextCore> context); 73 base::WeakPtr<ServiceWorkerContextCore> context,
74 ServiceWorkerRemoteProviderEndpoint* output_endpoint);
54 75
55 std::unique_ptr<ServiceWorkerProviderHost> 76 std::unique_ptr<ServiceWorkerProviderHost>
56 CreateProviderHostForServiceWorkerContext( 77 CreateProviderHostForServiceWorkerContext(
57 int process_id, 78 int process_id,
58 int provider_id, 79 int provider_id,
59 bool is_parent_frame_secure, 80 bool is_parent_frame_secure,
60 base::WeakPtr<ServiceWorkerContextCore> context); 81 base::WeakPtr<ServiceWorkerContextCore> context,
82 ServiceWorkerRemoteProviderEndpoint* output_endpoint);
61 83
62 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostWithDispatcherHost( 84 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostWithDispatcherHost(
63 int process_id, 85 int process_id,
64 int provider_id, 86 int provider_id,
65 base::WeakPtr<ServiceWorkerContextCore> context, 87 base::WeakPtr<ServiceWorkerContextCore> context,
66 int route_id, 88 int route_id,
67 ServiceWorkerDispatcherHost* dispatcher_host); 89 ServiceWorkerDispatcherHost* dispatcher_host,
90 ServiceWorkerRemoteProviderEndpoint* output_endpoint);
68 91
69 } // namespace content 92 } // namespace content
70 93
71 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ 94 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698