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

Side by Side Diff: mojo/shell/public/cpp/connector.h

Issue 1736663003: Eliminate Quit() from Shell, and roll Shell & Connector together. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@14cf
Patch Set: . Created 4 years, 10 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
« no previous file with comments | « mojo/shell/application_instance.cc ('k') | mojo/shell/public/cpp/lib/application_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 MOJO_SHELL_PUBLIC_CPP_CONNECTOR_H_ 5 #ifndef MOJO_SHELL_PUBLIC_CPP_CONNECTOR_H_
6 #define MOJO_SHELL_PUBLIC_CPP_CONNECTOR_H_ 6 #define MOJO_SHELL_PUBLIC_CPP_CONNECTOR_H_
7 7
8 #include "mojo/shell/public/cpp/connection.h" 8 #include "mojo/shell/public/cpp/connection.h"
9 #include "mojo/shell/public/interfaces/shell.mojom.h" 9 #include "mojo/shell/public/interfaces/shell.mojom.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 13
14 // An interface that encapsulates the Mojo Shell's broker interface by which 14 // An interface that encapsulates the Mojo Shell's broker interface by which
15 // connections between applications are established. Once Connect() is called, 15 // connections between applications are established. Once Connect() is called,
16 // this class is bound to the thread the call was made on and it cannot be 16 // this class is bound to the thread the call was made on and it cannot be
17 // passed to another thread without calling Clone(). 17 // passed to another thread without calling Clone().
18 // An instance of this class is created internally by ShellConnection for use 18 // An instance of this class is created internally by ShellConnection for use
19 // on the thread ShellConnection is instantiated on, and this interface is 19 // on the thread ShellConnection is instantiated on, and this interface is
20 // wrapped by the Shell interface. 20 // wrapped by the Shell interface.
21 // To use this interface on other threads, call Shell::CloneConnector() and 21 // To use this interface on other threads, call Shell::CloneConnector() and
22 // pass the result to another thread. To pass to subsequent threads, call 22 // pass the result to another thread. To pass to subsequent threads, call
23 // Clone() on instances of this object. 23 // Clone() on instances of this object.
24 // While instances of this object are owned by the caller, the underlying 24 // While instances of this object are owned by the caller, the underlying
25 // connection with the shell is bound to the lifetime of the instance that 25 // connection with the shell is bound to the lifetime of the instance that
26 // created it, i.e. when the application is terminated the Connector pipe is 26 // created it, i.e. when the application is terminated the Connector pipe is
27 // closed. 27 // closed.
28 class Connector { 28 class Connector {
29 public: 29 public:
30 virtual ~Connector() {}
31
30 class ConnectParams { 32 class ConnectParams {
31 public: 33 public:
32 explicit ConnectParams(const std::string& url); 34 explicit ConnectParams(const std::string& url);
33 ~ConnectParams(); 35 ~ConnectParams();
34 36
35 const GURL& url() { return url_; } 37 const GURL& url() { return url_; }
36 void set_user_id(uint32_t user_id) { user_id_ = user_id; } 38 void set_user_id(uint32_t user_id) { user_id_ = user_id; }
37 uint32_t user_id() const { return user_id_; } 39 uint32_t user_id() const { return user_id_; }
38 40
39 private: 41 private:
(...skipping 29 matching lines...) Expand all
69 71
70 // Creates a new instance of this class which may be passed to another thread. 72 // Creates a new instance of this class which may be passed to another thread.
71 // The returned object may be passed multiple times until Connect() is called, 73 // The returned object may be passed multiple times until Connect() is called,
72 // at which point this method must be called again to pass again. 74 // at which point this method must be called again to pass again.
73 virtual scoped_ptr<Connector> Clone() = 0; 75 virtual scoped_ptr<Connector> Clone() = 0;
74 }; 76 };
75 77
76 } // namespace mojo 78 } // namespace mojo
77 79
78 #endif // MOJO_SHELL_PUBLIC_CPP_CONNECTOR_H_ 80 #endif // MOJO_SHELL_PUBLIC_CPP_CONNECTOR_H_
OLDNEW
« no previous file with comments | « mojo/shell/application_instance.cc ('k') | mojo/shell/public/cpp/lib/application_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698