OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // TODO(ajwong): We need to come up with a better description of the | 5 // TODO(ajwong): We need to come up with a better description of the |
6 // responsibilities for each thread. | 6 // responsibilities for each thread. |
7 | 7 |
8 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ | 8 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
9 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ | 9 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 namespace protocol { | 37 namespace protocol { |
38 class ConnectionToHost; | 38 class ConnectionToHost; |
39 } // namespace protocol | 39 } // namespace protocol |
40 | 40 |
41 class ChromotingClient; | 41 class ChromotingClient; |
42 class ClientContext; | 42 class ClientContext; |
43 class InputHandler; | 43 class InputHandler; |
44 class JingleThread; | 44 class JingleThread; |
45 class PepperView; | 45 class PepperView; |
| 46 class PepperViewProxy; |
46 class RectangleUpdateDecoder; | 47 class RectangleUpdateDecoder; |
47 | 48 |
48 struct ClientConfig; | 49 struct ClientConfig; |
49 | 50 |
50 namespace protocol { | 51 namespace protocol { |
51 class HostConnection; | 52 class HostConnection; |
52 } // namespace protocol | 53 } // namespace protocol |
53 | 54 |
54 class ChromotingInstance : public pp::Instance { | 55 class ChromotingInstance : public pp::Instance { |
55 public: | 56 public: |
(...skipping 22 matching lines...) Expand all Loading... |
78 // init to figure out which thread we're on. This should only be used to | 79 // init to figure out which thread we're on. This should only be used to |
79 // sanity check which thread we're executing on. Do not post task here! | 80 // sanity check which thread we're executing on. Do not post task here! |
80 // Instead, use PPB_Core:CallOnMainThread() in the pepper api. | 81 // Instead, use PPB_Core:CallOnMainThread() in the pepper api. |
81 // | 82 // |
82 // TODO(ajwong): Think if there is a better way to safeguard this. | 83 // TODO(ajwong): Think if there is a better way to safeguard this. |
83 MessageLoop* pepper_main_loop_dont_post_to_me_; | 84 MessageLoop* pepper_main_loop_dont_post_to_me_; |
84 | 85 |
85 ClientContext context_; | 86 ClientContext context_; |
86 scoped_ptr<protocol::ConnectionToHost> host_connection_; | 87 scoped_ptr<protocol::ConnectionToHost> host_connection_; |
87 scoped_ptr<PepperView> view_; | 88 scoped_ptr<PepperView> view_; |
| 89 |
| 90 // PepperViewProxy is refcounted and used to interface between shromoting |
| 91 // objects and PepperView and perform thread switching. It wraps around |
| 92 // |view_| and receives method calls on chromoting threads. These method |
| 93 // calls are then delegates on the pepper thread. During destruction of |
| 94 // ChromotingInstance we need to detach PepperViewProxy from PepperView since |
| 95 // both ChromotingInstance and PepperView are destroyed and there will be |
| 96 // outstanding tasks on the pepper message loo. |
| 97 scoped_refptr<PepperViewProxy> view_proxy_; |
88 scoped_ptr<RectangleUpdateDecoder> rectangle_decoder_; | 98 scoped_ptr<RectangleUpdateDecoder> rectangle_decoder_; |
89 scoped_ptr<InputHandler> input_handler_; | 99 scoped_ptr<InputHandler> input_handler_; |
90 scoped_ptr<ChromotingClient> client_; | 100 scoped_ptr<ChromotingClient> client_; |
91 | 101 |
92 // JavaScript interface to control this instance. | 102 // JavaScript interface to control this instance. |
93 // This wraps a ChromotingScriptableObject in a pp::Var. | 103 // This wraps a ChromotingScriptableObject in a pp::Var. |
94 pp::Var instance_object_; | 104 pp::Var instance_object_; |
95 | 105 |
96 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance); | 106 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance); |
97 }; | 107 }; |
98 | 108 |
99 } // namespace remoting | 109 } // namespace remoting |
100 | 110 |
101 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ | 111 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
OLD | NEW |