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

Side by Side Diff: mojo/shell/context.h

Issue 420143003: mojo: shell::Context should outlive the shell MessageLoop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_CONTEXT_H_ 5 #ifndef MOJO_SHELL_CONTEXT_H_
6 #define MOJO_SHELL_CONTEXT_H_ 6 #define MOJO_SHELL_CONTEXT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "mojo/service_manager/service_manager.h" 10 #include "mojo/service_manager/service_manager.h"
(...skipping 12 matching lines...) Expand all
23 namespace shell { 23 namespace shell {
24 24
25 class DynamicServiceLoader; 25 class DynamicServiceLoader;
26 26
27 // The "global" context for the shell's main process. 27 // The "global" context for the shell's main process.
28 class Context { 28 class Context {
29 public: 29 public:
30 Context(); 30 Context();
31 ~Context(); 31 ~Context();
32 32
33 void Init();
33 // Tear down context in safe order prior to deleting. Shutdown() is also 34 // Tear down context in safe order prior to deleting. Shutdown() is also
34 // called by the destructor. 35 // called by the destructor.
35 void Shutdown(); 36 void Shutdown();
36 37
37 TaskRunners* task_runners() { return &task_runners_; } 38 TaskRunners* task_runners() { return task_runners_.get(); }
38 ServiceManager* service_manager() { return &service_manager_; } 39 ServiceManager* service_manager() { return &service_manager_; }
39 KeepAliveCounter* keep_alive_counter() { return &keep_alive_counter_; } 40 KeepAliveCounter* keep_alive_counter() { return &keep_alive_counter_; }
40 MojoURLResolver* mojo_url_resolver() { return &mojo_url_resolver_; } 41 MojoURLResolver* mojo_url_resolver() { return &mojo_url_resolver_; }
41 42
42 #if defined(OS_ANDROID) 43 #if defined(OS_ANDROID)
43 base::MessageLoop* ui_loop() const { return ui_loop_; } 44 base::MessageLoop* ui_loop() const { return ui_loop_; }
44 void set_ui_loop(base::MessageLoop* ui_loop) { ui_loop_ = ui_loop; } 45 void set_ui_loop(base::MessageLoop* ui_loop) { ui_loop_ = ui_loop; }
45 #endif // defined(OS_ANDROID) 46 #endif // defined(OS_ANDROID)
46 47
47 private: 48 private:
48 class NativeViewportServiceLoader; 49 class NativeViewportServiceLoader;
49 50
50 TaskRunners task_runners_; 51 scoped_ptr<TaskRunners> task_runners_;
51 ServiceManager service_manager_; 52 ServiceManager service_manager_;
52 MojoURLResolver mojo_url_resolver_; 53 MojoURLResolver mojo_url_resolver_;
53 scoped_ptr<Spy> spy_; 54 scoped_ptr<Spy> spy_;
54 #if defined(OS_ANDROID) 55 #if defined(OS_ANDROID)
55 base::MessageLoop* ui_loop_; 56 base::MessageLoop* ui_loop_;
56 #endif // defined(OS_ANDROID) 57 #endif // defined(OS_ANDROID)
57 58
58 KeepAliveCounter keep_alive_counter_; 59 KeepAliveCounter keep_alive_counter_;
59 60
60 DISALLOW_COPY_AND_ASSIGN(Context); 61 DISALLOW_COPY_AND_ASSIGN(Context);
61 }; 62 };
62 63
63 } // namespace shell 64 } // namespace shell
64 } // namespace mojo 65 } // namespace mojo
65 66
66 #endif // MOJO_SHELL_CONTEXT_H_ 67 #endif // MOJO_SHELL_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698