Chromium Code Reviews| 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 "content/renderer/media/rtc_peer_connection_handler.h" | 5 #include "content/renderer/media/rtc_peer_connection_handler.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 359 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread, | 359 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread, |
| 360 const blink::WebRTCSessionDescriptionRequest& request, | 360 const blink::WebRTCSessionDescriptionRequest& request, |
| 361 const base::WeakPtr<RTCPeerConnectionHandler>& handler, | 361 const base::WeakPtr<RTCPeerConnectionHandler>& handler, |
| 362 const base::WeakPtr<PeerConnectionTracker>& tracker, | 362 const base::WeakPtr<PeerConnectionTracker>& tracker, |
| 363 PeerConnectionTracker::Action action) | 363 PeerConnectionTracker::Action action) |
| 364 : main_thread_(main_thread), | 364 : main_thread_(main_thread), |
| 365 webkit_request_(request), | 365 webkit_request_(request), |
| 366 tracker_(handler, tracker, action) { | 366 tracker_(handler, tracker, action) { |
| 367 } | 367 } |
| 368 | 368 |
| 369 void OnSuccess(webrtc::SessionDescriptionInterface* desc) override { | 369 void OnSuccess(webrtc::SessionDescriptionInterface* desc) override { |
|
perkj_chrome
2016/08/15 05:37:57
webrtc::SessionDescriptionInterface* desc should h
hbos_chromium
2016/08/15 14:16:55
Oh, back to the drawing board.
hbos_chromium
2016/08/16 13:43:51
The template magic of base::Bind is beyond me, but
hbos_chromium
2016/08/17 09:51:15
Nevermind. The different printfs can be explained
| |
| 370 if (!main_thread_->BelongsToCurrentThread()) { | 370 if (!main_thread_->BelongsToCurrentThread()) { |
| 371 main_thread_->PostTask(FROM_HERE, | 371 main_thread_->PostTask(FROM_HERE, |
| 372 base::Bind(&CreateSessionDescriptionRequest::OnSuccess, this, desc)); | 372 base::Bind(&CreateSessionDescriptionRequest::OnSuccess, |
| 373 scoped_refptr<CreateSessionDescriptionRequest>(this), | |
| 374 desc)); | |
| 373 return; | 375 return; |
| 374 } | 376 } |
| 375 | 377 |
| 376 tracker_.TrackOnSuccess(desc); | 378 tracker_.TrackOnSuccess(desc); |
| 377 webkit_request_.requestSucceeded(CreateWebKitSessionDescription(desc)); | 379 webkit_request_.requestSucceeded(CreateWebKitSessionDescription(desc)); |
| 378 webkit_request_.reset(); | 380 webkit_request_.reset(); |
| 379 delete desc; | 381 delete desc; |
| 380 } | 382 } |
| 381 void OnFailure(const std::string& error) override { | 383 void OnFailure(const std::string& error) override { |
| 382 if (!main_thread_->BelongsToCurrentThread()) { | 384 if (!main_thread_->BelongsToCurrentThread()) { |
| 383 main_thread_->PostTask(FROM_HERE, | 385 main_thread_->PostTask(FROM_HERE, |
| 384 base::Bind(&CreateSessionDescriptionRequest::OnFailure, this, error)); | 386 base::Bind(&CreateSessionDescriptionRequest::OnFailure, |
| 387 scoped_refptr<CreateSessionDescriptionRequest>(this), | |
| 388 error)); | |
| 385 return; | 389 return; |
| 386 } | 390 } |
| 387 | 391 |
| 388 tracker_.TrackOnFailure(error); | 392 tracker_.TrackOnFailure(error); |
| 389 webkit_request_.requestFailed(base::UTF8ToUTF16(error)); | 393 webkit_request_.requestFailed(base::UTF8ToUTF16(error)); |
| 390 webkit_request_.reset(); | 394 webkit_request_.reset(); |
| 391 } | 395 } |
| 392 | 396 |
| 393 protected: | 397 protected: |
| 394 ~CreateSessionDescriptionRequest() override { | 398 ~CreateSessionDescriptionRequest() override { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 414 const base::WeakPtr<PeerConnectionTracker>& tracker, | 418 const base::WeakPtr<PeerConnectionTracker>& tracker, |
| 415 PeerConnectionTracker::Action action) | 419 PeerConnectionTracker::Action action) |
| 416 : main_thread_(main_thread), | 420 : main_thread_(main_thread), |
| 417 webkit_request_(request), | 421 webkit_request_(request), |
| 418 tracker_(handler, tracker, action) { | 422 tracker_(handler, tracker, action) { |
| 419 } | 423 } |
| 420 | 424 |
| 421 void OnSuccess() override { | 425 void OnSuccess() override { |
| 422 if (!main_thread_->BelongsToCurrentThread()) { | 426 if (!main_thread_->BelongsToCurrentThread()) { |
| 423 main_thread_->PostTask(FROM_HERE, | 427 main_thread_->PostTask(FROM_HERE, |
| 424 base::Bind(&SetSessionDescriptionRequest::OnSuccess, this)); | 428 base::Bind(&SetSessionDescriptionRequest::OnSuccess, |
| 429 scoped_refptr<SetSessionDescriptionRequest>(this))); | |
| 425 return; | 430 return; |
| 426 } | 431 } |
| 427 tracker_.TrackOnSuccess(NULL); | 432 tracker_.TrackOnSuccess(NULL); |
| 428 webkit_request_.requestSucceeded(); | 433 webkit_request_.requestSucceeded(); |
| 429 webkit_request_.reset(); | 434 webkit_request_.reset(); |
| 430 } | 435 } |
| 431 void OnFailure(const std::string& error) override { | 436 void OnFailure(const std::string& error) override { |
| 432 if (!main_thread_->BelongsToCurrentThread()) { | 437 if (!main_thread_->BelongsToCurrentThread()) { |
| 433 main_thread_->PostTask(FROM_HERE, | 438 main_thread_->PostTask(FROM_HERE, |
| 434 base::Bind(&SetSessionDescriptionRequest::OnFailure, this, error)); | 439 base::Bind(&SetSessionDescriptionRequest::OnFailure, |
| 440 scoped_refptr<SetSessionDescriptionRequest>(this), | |
| 441 error)); | |
| 435 return; | 442 return; |
| 436 } | 443 } |
| 437 tracker_.TrackOnFailure(error); | 444 tracker_.TrackOnFailure(error); |
| 438 webkit_request_.requestFailed(base::UTF8ToUTF16(error)); | 445 webkit_request_.requestFailed(base::UTF8ToUTF16(error)); |
| 439 webkit_request_.reset(); | 446 webkit_request_.reset(); |
| 440 } | 447 } |
| 441 | 448 |
| 442 protected: | 449 protected: |
| 443 ~SetSessionDescriptionRequest() override { | 450 ~SetSessionDescriptionRequest() override { |
| 444 DCHECK(main_thread_->BelongsToCurrentThread()); | 451 DCHECK(main_thread_->BelongsToCurrentThread()); |
| (...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1894 } | 1901 } |
| 1895 | 1902 |
| 1896 void RTCPeerConnectionHandler::ResetUMAStats() { | 1903 void RTCPeerConnectionHandler::ResetUMAStats() { |
| 1897 DCHECK(thread_checker_.CalledOnValidThread()); | 1904 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1898 num_local_candidates_ipv6_ = 0; | 1905 num_local_candidates_ipv6_ = 0; |
| 1899 num_local_candidates_ipv4_ = 0; | 1906 num_local_candidates_ipv4_ = 0; |
| 1900 ice_connection_checking_start_ = base::TimeTicks(); | 1907 ice_connection_checking_start_ = base::TimeTicks(); |
| 1901 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); | 1908 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); |
| 1902 } | 1909 } |
| 1903 } // namespace content | 1910 } // namespace content |
| OLD | NEW |