| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "remoting/client/plugin/chromoting_instance.h" | 5 #include "remoting/client/plugin/chromoting_instance.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include <nacl_io/nacl_io.h> | 10 #include <nacl_io/nacl_io.h> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "ppapi/cpp/rect.h" | 35 #include "ppapi/cpp/rect.h" |
| 36 #include "ppapi/cpp/var_array_buffer.h" | 36 #include "ppapi/cpp/var_array_buffer.h" |
| 37 #include "ppapi/cpp/var_dictionary.h" | 37 #include "ppapi/cpp/var_dictionary.h" |
| 38 #include "remoting/base/constants.h" | 38 #include "remoting/base/constants.h" |
| 39 #include "remoting/base/util.h" | 39 #include "remoting/base/util.h" |
| 40 #include "remoting/client/chromoting_client.h" | 40 #include "remoting/client/chromoting_client.h" |
| 41 #include "remoting/client/normalizing_input_filter_cros.h" | 41 #include "remoting/client/normalizing_input_filter_cros.h" |
| 42 #include "remoting/client/normalizing_input_filter_mac.h" | 42 #include "remoting/client/normalizing_input_filter_mac.h" |
| 43 #include "remoting/client/plugin/delegating_signal_strategy.h" | 43 #include "remoting/client/plugin/delegating_signal_strategy.h" |
| 44 #include "remoting/client/plugin/pepper_audio_player.h" | 44 #include "remoting/client/plugin/pepper_audio_player.h" |
| 45 #include "remoting/client/plugin/pepper_main_thread_task_runner.h" |
| 45 #include "remoting/client/plugin/pepper_mouse_locker.h" | 46 #include "remoting/client/plugin/pepper_mouse_locker.h" |
| 46 #include "remoting/client/plugin/pepper_port_allocator.h" | 47 #include "remoting/client/plugin/pepper_port_allocator.h" |
| 47 #include "remoting/client/plugin/pepper_video_renderer_2d.h" | 48 #include "remoting/client/plugin/pepper_video_renderer_2d.h" |
| 48 #include "remoting/client/plugin/pepper_video_renderer_3d.h" | 49 #include "remoting/client/plugin/pepper_video_renderer_3d.h" |
| 49 #include "remoting/client/software_video_renderer.h" | 50 #include "remoting/client/software_video_renderer.h" |
| 50 #include "remoting/client/token_fetcher_proxy.h" | 51 #include "remoting/client/token_fetcher_proxy.h" |
| 51 #include "remoting/protocol/connection_to_host.h" | 52 #include "remoting/protocol/connection_to_host.h" |
| 52 #include "remoting/protocol/host_stub.h" | 53 #include "remoting/protocol/host_stub.h" |
| 53 #include "remoting/protocol/libjingle_transport_factory.h" | 54 #include "remoting/protocol/libjingle_transport_factory.h" |
| 54 #include "url/gurl.h" | 55 #include "url/gurl.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 131 |
| 131 PP_Instance g_logging_instance = 0; | 132 PP_Instance g_logging_instance = 0; |
| 132 base::LazyInstance<base::Lock>::Leaky g_logging_lock = | 133 base::LazyInstance<base::Lock>::Leaky g_logging_lock = |
| 133 LAZY_INSTANCE_INITIALIZER; | 134 LAZY_INSTANCE_INITIALIZER; |
| 134 | 135 |
| 135 } // namespace | 136 } // namespace |
| 136 | 137 |
| 137 ChromotingInstance::ChromotingInstance(PP_Instance pp_instance) | 138 ChromotingInstance::ChromotingInstance(PP_Instance pp_instance) |
| 138 : pp::Instance(pp_instance), | 139 : pp::Instance(pp_instance), |
| 139 initialized_(false), | 140 initialized_(false), |
| 140 plugin_task_runner_(new PluginThreadTaskRunner(&plugin_thread_delegate_)), | 141 plugin_task_runner_(new PepperMainThreadTaskRunner()), |
| 141 context_(plugin_task_runner_.get()), | 142 context_(plugin_task_runner_.get()), |
| 142 input_tracker_(&mouse_input_filter_), | 143 input_tracker_(&mouse_input_filter_), |
| 143 touch_input_scaler_(&input_tracker_), | 144 touch_input_scaler_(&input_tracker_), |
| 144 key_mapper_(&touch_input_scaler_), | 145 key_mapper_(&touch_input_scaler_), |
| 145 input_handler_(&input_tracker_), | 146 input_handler_(&input_tracker_), |
| 146 cursor_setter_(this), | 147 cursor_setter_(this), |
| 147 empty_cursor_filter_(&cursor_setter_), | 148 empty_cursor_filter_(&cursor_setter_), |
| 148 text_input_controller_(this), | 149 text_input_controller_(this), |
| 149 use_async_pin_dialog_(false), | 150 use_async_pin_dialog_(false), |
| 150 weak_factory_(this) { | 151 weak_factory_(this) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 ChromotingInstance::~ChromotingInstance() { | 186 ChromotingInstance::~ChromotingInstance() { |
| 186 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); | 187 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
| 187 | 188 |
| 188 // Disconnect the client. | 189 // Disconnect the client. |
| 189 Disconnect(); | 190 Disconnect(); |
| 190 | 191 |
| 191 // Unregister this instance so that debug log messages will no longer be sent | 192 // Unregister this instance so that debug log messages will no longer be sent |
| 192 // to it. This will stop all logging in all Chromoting instances. | 193 // to it. This will stop all logging in all Chromoting instances. |
| 193 UnregisterLoggingInstance(); | 194 UnregisterLoggingInstance(); |
| 194 | 195 |
| 195 plugin_task_runner_->Quit(); | |
| 196 | |
| 197 // Ensure that nothing touches the plugin thread delegate after this point. | |
| 198 plugin_task_runner_->DetachAndRunShutdownLoop(); | |
| 199 | |
| 200 // Stopping the context shuts down all chromoting threads. | 196 // Stopping the context shuts down all chromoting threads. |
| 201 context_.Stop(); | 197 context_.Stop(); |
| 202 } | 198 } |
| 203 | 199 |
| 204 bool ChromotingInstance::Init(uint32_t argc, | 200 bool ChromotingInstance::Init(uint32_t argc, |
| 205 const char* argn[], | 201 const char* argn[], |
| 206 const char* argv[]) { | 202 const char* argv[]) { |
| 207 CHECK(!initialized_); | 203 CHECK(!initialized_); |
| 208 initialized_ = true; | 204 initialized_ = true; |
| 209 | 205 |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 if (is_custom_counts_histogram) { | 1141 if (is_custom_counts_histogram) { |
| 1146 uma.HistogramCustomCounts(histogram_name, value, histogram_min, | 1142 uma.HistogramCustomCounts(histogram_name, value, histogram_min, |
| 1147 histogram_max, histogram_buckets); | 1143 histogram_max, histogram_buckets); |
| 1148 } else { | 1144 } else { |
| 1149 uma.HistogramCustomTimes(histogram_name, value, histogram_min, | 1145 uma.HistogramCustomTimes(histogram_name, value, histogram_min, |
| 1150 histogram_max, histogram_buckets); | 1146 histogram_max, histogram_buckets); |
| 1151 } | 1147 } |
| 1152 } | 1148 } |
| 1153 | 1149 |
| 1154 } // namespace remoting | 1150 } // namespace remoting |
| OLD | NEW |