Chromium Code Reviews| Index: remoting/host/it2me/it2me_native_messaging_host.cc |
| diff --git a/remoting/host/it2me/it2me_native_messaging_host.cc b/remoting/host/it2me/it2me_native_messaging_host.cc |
| index 24ddc1b8dc38c72475555f4c0dbc00ea915aa62d..59e210f89e9d2d277068c9f61ddbffa319f093a3 100644 |
| --- a/remoting/host/it2me/it2me_native_messaging_host.cc |
| +++ b/remoting/host/it2me/it2me_native_messaging_host.cc |
| @@ -15,8 +15,9 @@ |
| #include "base/strings/stringize_macros.h" |
| #include "base/threading/thread.h" |
| #include "base/values.h" |
| +#include "media/base/media.h" |
| #include "net/base/net_util.h" |
| -#include "net/url_request/url_fetcher.h" |
| +#include "net/url_request/url_request_context_getter.h" |
| #include "remoting/base/auth_token_util.h" |
| #include "remoting/base/service_urls.h" |
| #include "remoting/host/chromoting_host_context.h" |
| @@ -35,23 +36,23 @@ const remoting::protocol::NameMapElement<It2MeHostState> kIt2MeHostStates[] = { |
| {kConnected, "CONNECTED"}, |
| {kDisconnecting, "DISCONNECTING"}, |
| {kError, "ERROR"}, |
| - {kInvalidDomainError, "INVALID_DOMAIN_ERROR"}, }; |
| + {kInvalidDomainError, "INVALID_DOMAIN_ERROR"}, |
| +}; |
| } // namespace |
| It2MeNativeMessagingHost::It2MeNativeMessagingHost( |
| - scoped_refptr<AutoThreadTaskRunner> task_runner, |
| + scoped_ptr<ChromotingHostContext> context, |
| scoped_ptr<It2MeHostFactory> factory) |
| : client_(NULL), |
| + task_runner_(context->ui_task_runner()), |
|
Wez
2014/10/24 00:28:48
Why pull this out here, rather than just referring
kelvinp
2014/10/24 21:39:42
Done.
|
| + host_context_(context.Pass()), |
| factory_(factory.Pass()), |
| weak_factory_(this) { |
| weak_ptr_ = weak_factory_.GetWeakPtr(); |
| - // Initialize the host context to manage the threads for the it2me host. |
| - // The native messaging host, rather than the It2MeHost object, owns and |
| - // maintains the lifetime of the host context. |
| - |
| - host_context_.reset(ChromotingHostContext::Create(task_runner).release()); |
| + // Ensures runtime specific CPU features are initialized. |
| + media::InitializeCPUSpecificMediaFeatures(); |
| const ServiceUrls* service_urls = ServiceUrls::GetInstance(); |
| const bool xmpp_server_valid = |
| @@ -203,8 +204,7 @@ void It2MeNativeMessagingHost::ProcessConnect( |
| #endif // !defined(NDEBUG) |
| // Create the It2Me host and start connecting. |
| - it2me_host_ = factory_->CreateIt2MeHost(host_context_.get(), |
| - host_context_->ui_task_runner(), |
| + it2me_host_ = factory_->CreateIt2MeHost(host_context_->Copy(), |
| weak_ptr_, |
| xmpp_config, |
| directory_bot_jid_); |
| @@ -303,7 +303,7 @@ void It2MeNativeMessagingHost::OnClientAuthenticated( |
| scoped_refptr<base::SingleThreadTaskRunner> |
| It2MeNativeMessagingHost::task_runner() const { |
| - return host_context_->ui_task_runner(); |
| + return task_runner_; |
| } |
| /* static */ |