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

Side by Side Diff: content/renderer/media/media_stream_dependency_factory.cc

Issue 11093061: Enable peerconnection to use the NSS RNG. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 2 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) 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 "content/renderer/media/media_stream_dependency_factory.h" 5 #include "content/renderer/media/media_stream_dependency_factory.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "content/renderer/media/media_stream_source_extra_data.h" 11 #include "content/renderer/media/media_stream_source_extra_data.h"
12 #include "content/renderer/media/peer_connection_handler_jsep.h" 12 #include "content/renderer/media/peer_connection_handler_jsep.h"
13 #include "content/renderer/media/rtc_peer_connection_handler.h" 13 #include "content/renderer/media/rtc_peer_connection_handler.h"
14 #include "content/renderer/media/rtc_video_capturer.h" 14 #include "content/renderer/media/rtc_video_capturer.h"
15 #include "content/renderer/media/video_capture_impl_manager.h" 15 #include "content/renderer/media/video_capture_impl_manager.h"
16 #include "content/renderer/media/webrtc_audio_device_impl.h" 16 #include "content/renderer/media/webrtc_audio_device_impl.h"
17 #include "content/renderer/media/webrtc_uma_histograms.h" 17 #include "content/renderer/media/webrtc_uma_histograms.h"
18 #include "content/renderer/p2p/ipc_network_manager.h" 18 #include "content/renderer/p2p/ipc_network_manager.h"
19 #include "content/renderer/p2p/ipc_socket_factory.h" 19 #include "content/renderer/p2p/ipc_socket_factory.h"
20 #include "content/renderer/p2p/port_allocator.h" 20 #include "content/renderer/p2p/port_allocator.h"
21 #include "jingle/glue/thread_wrapper.h" 21 #include "jingle/glue/thread_wrapper.h"
22 #include "net/socket/nss_ssl_util.h"
Ryan Sleevi 2012/10/10 23:59:15 #if !defined(USE_OPENSSL) #include "net/socket/nss
Ronghua Wu (Left Chromium) 2012/10/11 00:17:18 Done.
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amComponent.h" 24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amComponent.h"
24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amDescriptor.h" 25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amDescriptor.h"
25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSource.h" 26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSource.h"
26 27
27 class P2PPortAllocatorFactory : public webrtc::PortAllocatorFactoryInterface { 28 class P2PPortAllocatorFactory : public webrtc::PortAllocatorFactoryInterface {
28 public: 29 public:
29 P2PPortAllocatorFactory( 30 P2PPortAllocatorFactory(
30 content::P2PSocketDispatcher* socket_dispatcher, 31 content::P2PSocketDispatcher* socket_dispatcher,
31 talk_base::NetworkManager* network_manager, 32 talk_base::NetworkManager* network_manager,
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 base::Unretained(this), 346 base::Unretained(this),
346 &event)); 347 &event));
347 event.Wait(); 348 event.Wait();
348 } 349 }
349 350
350 if (!socket_factory_.get()) { 351 if (!socket_factory_.get()) {
351 socket_factory_.reset( 352 socket_factory_.reset(
352 new content::IpcPacketSocketFactory(p2p_socket_dispatcher_)); 353 new content::IpcPacketSocketFactory(p2p_socket_dispatcher_));
353 } 354 }
354 355
356 // Init NSS which will be needed by PeerConnection.
ekr 2012/10/10 23:48:34 I may have lost the thread but I thought we needed
Ronghua Wu (Left Chromium) 2012/10/11 00:17:18 Last reply from Ryan seems to say the ForceNSSNoDB
Ryan Sleevi 2012/10/11 00:26:06 No, you are correct, it is not needed. If/when it
357 net::EnsureNSSSSLInit();
Sergey Ulanov 2012/10/10 23:59:01 NSS is initialized in ChromeRenderProcessObserver:
Ryan Sleevi 2012/10/10 23:59:15 #if !defined(USE_OPENSSL) // Init NSS which will b
Ronghua Wu (Left Chromium) 2012/10/11 00:17:18 Done.
358
355 if (!CreatePeerConnectionFactory()) { 359 if (!CreatePeerConnectionFactory()) {
356 LOG(ERROR) << "Could not create PeerConnection factory"; 360 LOG(ERROR) << "Could not create PeerConnection factory";
357 return false; 361 return false;
358 } 362 }
363
ekr 2012/10/10 23:48:34 Whitespace only change.
Ronghua Wu (Left Chromium) 2012/10/11 00:17:18 Done.
359 return true; 364 return true;
360 } 365 }
361 366
362 void MediaStreamDependencyFactory::CleanupPeerConnectionFactory() { 367 void MediaStreamDependencyFactory::CleanupPeerConnectionFactory() {
363 pc_factory_ = NULL; 368 pc_factory_ = NULL;
364 if (network_manager_) { 369 if (network_manager_) {
365 // The network manager needs to free its resources on the thread they were 370 // The network manager needs to free its resources on the thread they were
366 // created, which is the worked thread. 371 // created, which is the worked thread.
367 if (chrome_worker_thread_.IsRunning()) { 372 if (chrome_worker_thread_.IsRunning()) {
368 chrome_worker_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( 373 chrome_worker_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(
369 &MediaStreamDependencyFactory::DeleteIpcNetworkManager, 374 &MediaStreamDependencyFactory::DeleteIpcNetworkManager,
370 base::Unretained(this))); 375 base::Unretained(this)));
371 // Stopping the thread will wait until all tasks have been 376 // Stopping the thread will wait until all tasks have been
372 // processed before returning. We wait for the above task to finish before 377 // processed before returning. We wait for the above task to finish before
373 // letting the the function continue to avoid any potential race issues. 378 // letting the the function continue to avoid any potential race issues.
374 chrome_worker_thread_.Stop(); 379 chrome_worker_thread_.Stop();
375 } else { 380 } else {
376 NOTREACHED() << "Worker thread not running."; 381 NOTREACHED() << "Worker thread not running.";
377 } 382 }
378 } 383 }
379 } 384 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698