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

Side by Side Diff: remoting/client/plugin/chromoting_instance.cc

Issue 6623048: Replace libjingle's HttpPortAllocatorSession with Pepper's http client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thread switching Created 9 years, 9 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 (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 #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 "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/task.h" 12 #include "base/task.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 // TODO(sergeyu): We should not depend on renderer here. Instead P2P 14 // TODO(sergeyu): We should not depend on renderer here. Instead P2P
15 // Pepper API should be used. Remove this dependency. 15 // Pepper API should be used. Remove this dependency.
16 // crbug.com/74951 16 // crbug.com/74951
17 #include "chrome/renderer/p2p/ipc_network_manager.h" 17 #include "chrome/renderer/p2p/ipc_network_manager.h"
18 #include "chrome/renderer/p2p/ipc_socket_factory.h" 18 #include "chrome/renderer/p2p/ipc_socket_factory.h"
19 #include "ppapi/c/pp_input_event.h" 19 #include "ppapi/c/pp_input_event.h"
20 #include "ppapi/cpp/completion_callback.h" 20 #include "ppapi/cpp/completion_callback.h"
21 #include "ppapi/cpp/rect.h" 21 #include "ppapi/cpp/rect.h"
22 #include "remoting/client/client_config.h" 22 #include "remoting/client/client_config.h"
23 #include "remoting/client/client_util.h" 23 #include "remoting/client/client_util.h"
24 #include "remoting/client/chromoting_client.h" 24 #include "remoting/client/chromoting_client.h"
25 #include "remoting/client/rectangle_update_decoder.h" 25 #include "remoting/client/rectangle_update_decoder.h"
26 #include "remoting/client/plugin/chromoting_scriptable_object.h" 26 #include "remoting/client/plugin/chromoting_scriptable_object.h"
27 #include "remoting/client/plugin/pepper_input_handler.h" 27 #include "remoting/client/plugin/pepper_input_handler.h"
28 #include "remoting/client/plugin/pepper_port_allocator_session.h"
28 #include "remoting/client/plugin/pepper_view.h" 29 #include "remoting/client/plugin/pepper_view.h"
29 #include "remoting/client/plugin/pepper_view_proxy.h" 30 #include "remoting/client/plugin/pepper_view_proxy.h"
30 #include "remoting/jingle_glue/jingle_thread.h" 31 #include "remoting/jingle_glue/jingle_thread.h"
31 #include "remoting/proto/auth.pb.h" 32 #include "remoting/proto/auth.pb.h"
32 #include "remoting/protocol/connection_to_host.h" 33 #include "remoting/protocol/connection_to_host.h"
33 // TODO(sergeyu): This is a hack: plugin should not depend on webkit 34 // TODO(sergeyu): This is a hack: plugin should not depend on webkit
34 // glue. It is used here to get P2PPacketDispatcher corresponding to 35 // glue. It is used here to get P2PPacketDispatcher corresponding to
35 // the current RenderView. Use P2P Pepper API for connection and 36 // the current RenderView. Use P2P Pepper API for connection and
36 // remove these includes. 37 // remove these includes.
37 // crbug.com/74951 38 // crbug.com/74951
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Start all the threads. 81 // Start all the threads.
81 context_.Start(); 82 context_.Start();
82 83
83 webkit::ppapi::PluginInstance* plugin_instance = 84 webkit::ppapi::PluginInstance* plugin_instance =
84 webkit::ppapi::ResourceTracker::Get()->GetInstance(pp_instance()); 85 webkit::ppapi::ResourceTracker::Get()->GetInstance(pp_instance());
85 86
86 P2PSocketDispatcher* socket_dispatcher = 87 P2PSocketDispatcher* socket_dispatcher =
87 plugin_instance->delegate()->GetP2PSocketDispatcher(); 88 plugin_instance->delegate()->GetP2PSocketDispatcher();
88 IpcNetworkManager* network_manager = NULL; 89 IpcNetworkManager* network_manager = NULL;
89 IpcPacketSocketFactory* socket_factory = NULL; 90 IpcPacketSocketFactory* socket_factory = NULL;
91 PortAllocatorSessionFactory* session_factory =
92 PepperPortAllocatorSession::CreateFactory(this);
90 93
91 // If we don't have socket dispatcher for IPC (e.g. P2P API is 94 // If we don't have socket dispatcher for IPC (e.g. P2P API is
92 // disabled), then JingleClient will try to use physical sockets. 95 // disabled), then JingleClient will try to use physical sockets.
93 if (socket_dispatcher) { 96 if (socket_dispatcher) {
94 VLOG(1) << "Creating IpcNetworkManager and IpcPacketSocketFactory."; 97 VLOG(1) << "Creating IpcNetworkManager and IpcPacketSocketFactory.";
95 network_manager = new IpcNetworkManager(socket_dispatcher); 98 network_manager = new IpcNetworkManager(socket_dispatcher);
96 socket_factory = new IpcPacketSocketFactory(socket_dispatcher); 99 socket_factory = new IpcPacketSocketFactory(socket_dispatcher);
97 } 100 }
98 101
99 // Create the chromoting objects. 102 // Create the chromoting objects.
100 host_connection_.reset(new protocol::ConnectionToHost( 103 host_connection_.reset(new protocol::ConnectionToHost(
101 context_.jingle_thread(), network_manager, socket_factory)); 104 context_.jingle_thread(), network_manager, socket_factory,
105 session_factory));
102 view_.reset(new PepperView(this, &context_)); 106 view_.reset(new PepperView(this, &context_));
103 view_proxy_ = new PepperViewProxy(this, view_.get()); 107 view_proxy_ = new PepperViewProxy(this, view_.get());
104 rectangle_decoder_ = new RectangleUpdateDecoder( 108 rectangle_decoder_ = new RectangleUpdateDecoder(
105 context_.decode_message_loop(), view_proxy_); 109 context_.decode_message_loop(), view_proxy_);
106 input_handler_.reset(new PepperInputHandler(&context_, 110 input_handler_.reset(new PepperInputHandler(&context_,
107 host_connection_.get(), 111 host_connection_.get(),
108 view_proxy_)); 112 view_proxy_));
109 113
110 // Default to a medium grey. 114 // Default to a medium grey.
111 view_->SetSolidFill(0xFFCDCDCD); 115 view_->SetSolidFill(0xFFCDCDCD);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 object->Init(); 246 object->Init();
243 247
244 // The pp::Var takes ownership of object here. 248 // The pp::Var takes ownership of object here.
245 instance_object_ = pp::Var(this, object); 249 instance_object_ = pp::Var(this, object);
246 } 250 }
247 251
248 return instance_object_; 252 return instance_object_;
249 } 253 }
250 254
251 } // namespace remoting 255 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/client/plugin/pepper_entrypoints.h » ('j') | remoting/client/plugin/pepper_port_allocator_session.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698