OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/cast_channel/cast_channel_api.h" | 5 #include "extensions/browser/api/cast_channel/cast_channel_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <limits> | 10 #include <limits> |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 delegate.reset(keep_alive); | 339 delegate.reset(keep_alive); |
340 } | 340 } |
341 | 341 |
342 socket->Connect(std::move(delegate), | 342 socket->Connect(std::move(delegate), |
343 base::Bind(&CastChannelOpenFunction::OnOpen, this)); | 343 base::Bind(&CastChannelOpenFunction::OnOpen, this)); |
344 } | 344 } |
345 | 345 |
346 void CastChannelOpenFunction::OnOpen(cast_channel::ChannelError result) { | 346 void CastChannelOpenFunction::OnOpen(cast_channel::ChannelError result) { |
347 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 347 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
348 VLOG(1) << "Connect finished, OnOpen invoked."; | 348 VLOG(1) << "Connect finished, OnOpen invoked."; |
349 CastSocket* socket = GetSocket(new_channel_id_); | 349 if (result == cast_channel::CHANNEL_ERROR_NONE) { |
imcheng
2017/02/17 22:34:45
I changed the behavior slightly. It's not clear to
mark a. foltz
2017/02/21 18:30:01
IIRC, GetSocket should never be nullptr. AddSocke
imcheng
2017/02/21 22:55:47
Yeah. I reasoned that since CastSocket is always o
| |
350 if (!socket) { | 350 CastSocket* socket = GetSocket(new_channel_id_); |
351 CHECK(socket); | |
mark a. foltz
2017/02/21 18:30:01
SECURITY_CHECK?
imcheng
2017/02/21 22:55:47
Done.
imcheng
2017/02/21 23:34:20
Turns out SECURITY_CHECK is defined in Blink codeb
| |
352 SetResultFromSocket(*socket); | |
353 } else { | |
351 SetResultFromError(new_channel_id_, result); | 354 SetResultFromError(new_channel_id_, result); |
mark a. foltz
2017/02/21 18:33:20
If you want to aggressively destroy sockets on fai
imcheng
2017/02/21 22:55:47
I will save it for a separate patch as it's a risk
| |
352 } else { | |
353 SetResultFromSocket(*socket); | |
354 } | 355 } |
356 | |
355 AsyncWorkCompleted(); | 357 AsyncWorkCompleted(); |
356 } | 358 } |
357 | 359 |
358 CastChannelSendFunction::CastChannelSendFunction() { } | 360 CastChannelSendFunction::CastChannelSendFunction() { } |
359 | 361 |
360 CastChannelSendFunction::~CastChannelSendFunction() { } | 362 CastChannelSendFunction::~CastChannelSendFunction() { } |
361 | 363 |
362 bool CastChannelSendFunction::Prepare() { | 364 bool CastChannelSendFunction::Prepare() { |
363 params_ = Send::Params::Create(*args_); | 365 params_ = Send::Params::Create(*args_); |
364 EXTENSION_FUNCTION_VALIDATE(params_.get()); | 366 EXTENSION_FUNCTION_VALIDATE(params_.get()); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
512 BrowserThread::PostTask( | 514 BrowserThread::PostTask( |
513 BrowserThread::UI, FROM_HERE, | 515 BrowserThread::UI, FROM_HERE, |
514 base::Bind(ui_dispatch_cb_, socket_->owner_extension_id(), | 516 base::Bind(ui_dispatch_cb_, socket_->owner_extension_id(), |
515 base::Passed(std::move(event)))); | 517 base::Passed(std::move(event)))); |
516 } | 518 } |
517 | 519 |
518 void CastChannelOpenFunction::CastMessageHandler::Start() { | 520 void CastChannelOpenFunction::CastMessageHandler::Start() { |
519 } | 521 } |
520 | 522 |
521 } // namespace extensions | 523 } // namespace extensions |
OLD | NEW |