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

Side by Side Diff: content/child/navigator_connect/navigator_connect_provider.h

Issue 944443003: Step two of optionally sending messages to/from message ports as base::Value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-message-as-values-take2
Patch Set: use auto where it makes sense Created 5 years, 9 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_CHILD_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_PROVIDER_H_ 5 #ifndef CONTENT_CHILD_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_PROVIDER_H_
6 #define CONTENT_CHILD_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_PROVIDER_H_ 6 #define CONTENT_CHILD_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_PROVIDER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/id_map.h" 9 #include "base/id_map.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 10 matching lines...) Expand all
21 class WebMessagePortChannel; 21 class WebMessagePortChannel;
22 class WebString; 22 class WebString;
23 } 23 }
24 24
25 namespace IPC { 25 namespace IPC {
26 class Message; 26 class Message;
27 } 27 }
28 28
29 namespace content { 29 namespace content {
30 class ThreadSafeSender; 30 class ThreadSafeSender;
31 struct TransferredMessagePort;
31 32
32 // Main entry point for the navigator.connect API in a child process. This 33 // Main entry point for the navigator.connect API in a child process. This
33 // implements the blink API and passes connect calls on to the browser process. 34 // implements the blink API and passes connect calls on to the browser process.
34 // NavigatorConnectDispatcher receives IPCs from the browser process and passes 35 // NavigatorConnectDispatcher receives IPCs from the browser process and passes
35 // them on to the correct thread specific instance of this class. 36 // them on to the correct thread specific instance of this class.
36 // The ThreadSpecificInstance method will return an instance of this class for 37 // The ThreadSpecificInstance method will return an instance of this class for
37 // the current thread, or create one if no instance exists yet for this thread. 38 // the current thread, or create one if no instance exists yet for this thread.
38 // This class deletes itself if the worker thread it belongs to quits. 39 // This class deletes itself if the worker thread it belongs to quits.
39 class NavigatorConnectProvider : public blink::WebNavigatorConnectProvider, 40 class NavigatorConnectProvider : public blink::WebNavigatorConnectProvider,
40 public WorkerTaskRunner::Observer { 41 public WorkerTaskRunner::Observer {
(...skipping 12 matching lines...) Expand all
53 54
54 // |thread_safe_sender| and |main_loop| need to be passed in because if the 55 // |thread_safe_sender| and |main_loop| need to be passed in because if the
55 // call leads to construction they will be needed. 56 // call leads to construction they will be needed.
56 static NavigatorConnectProvider* ThreadSpecificInstance( 57 static NavigatorConnectProvider* ThreadSpecificInstance(
57 ThreadSafeSender* thread_safe_sender, 58 ThreadSafeSender* thread_safe_sender,
58 const scoped_refptr<base::SingleThreadTaskRunner>& main_loop); 59 const scoped_refptr<base::SingleThreadTaskRunner>& main_loop);
59 60
60 private: 61 private:
61 void OnConnectResult(int thread_id, 62 void OnConnectResult(int thread_id,
62 int request_id, 63 int request_id,
63 int message_port_id, 64 const TransferredMessagePort& message_port,
64 int message_port_route_id, 65 int message_port_route_id,
65 bool allow_connect); 66 bool allow_connect);
66 67
67 // WorkerTaskRunner::Observer implementation. 68 // WorkerTaskRunner::Observer implementation.
68 void OnWorkerRunLoopStopped() override; 69 void OnWorkerRunLoopStopped() override;
69 70
70 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 71 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
71 scoped_refptr<base::SingleThreadTaskRunner> main_loop_; 72 scoped_refptr<base::SingleThreadTaskRunner> main_loop_;
72 IDMap<blink::WebNavigatorConnectPortCallbacks, IDMapOwnPointer> requests_; 73 IDMap<blink::WebNavigatorConnectPortCallbacks, IDMapOwnPointer> requests_;
73 74
74 DISALLOW_COPY_AND_ASSIGN(NavigatorConnectProvider); 75 DISALLOW_COPY_AND_ASSIGN(NavigatorConnectProvider);
75 }; 76 };
76 77
77 } // namespace content 78 } // namespace content
78 79
79 #endif // CONTENT_CHILD_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_PROVIDER_H_ 80 #endif // CONTENT_CHILD_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_PROVIDER_H_
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/child/navigator_connect/navigator_connect_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698