OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/renderer_host/websocket_host.h" | 5 #include "content/browser/renderer_host/websocket_host.h" |
6 | 6 |
7 #include <inttypes.h> | 7 #include <inttypes.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 partition->GetFileSystemContext(); | 493 partition->GetFileSystemContext(); |
494 | 494 |
495 net::WebSocketEventInterface::ChannelState channel_state = | 495 net::WebSocketEventInterface::ChannelState channel_state = |
496 net::WebSocketEventInterface::CHANNEL_ALIVE; | 496 net::WebSocketEventInterface::CHANNEL_ALIVE; |
497 | 497 |
498 // This use of base::Unretained is safe because the WebSocketBlobSender object | 498 // This use of base::Unretained is safe because the WebSocketBlobSender object |
499 // is owned by this object and will not call it back after destruction. | 499 // is owned by this object and will not call it back after destruction. |
500 int rv = blob_sender_->Start( | 500 int rv = blob_sender_->Start( |
501 uuid, expected_size, dispatcher_->blob_storage_context(), | 501 uuid, expected_size, dispatcher_->blob_storage_context(), |
502 file_system_context, | 502 file_system_context, |
503 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get(), | 503 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get(), |
504 &channel_state, | 504 &channel_state, |
505 base::Bind(&WebSocketHost::BlobSendComplete, base::Unretained(this))); | 505 base::Bind(&WebSocketHost::BlobSendComplete, base::Unretained(this))); |
506 if (channel_state == net::WebSocketEventInterface::CHANNEL_ALIVE && | 506 if (channel_state == net::WebSocketEventInterface::CHANNEL_ALIVE && |
507 rv != net::ERR_IO_PENDING) | 507 rv != net::ERR_IO_PENDING) |
508 BlobSendComplete(rv); | 508 BlobSendComplete(rv); |
509 // |this| may be destroyed here. | 509 // |this| may be destroyed here. |
510 } | 510 } |
511 | 511 |
512 void WebSocketHost::OnSendFrame(bool fin, | 512 void WebSocketHost::OnSendFrame(bool fin, |
513 WebSocketMessageType type, | 513 WebSocketMessageType type, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 default: | 593 default: |
594 ignore_result(dispatcher_->NotifyFailure( | 594 ignore_result(dispatcher_->NotifyFailure( |
595 routing_id_, | 595 routing_id_, |
596 "Failed to load Blob: error code = " + net::ErrorToString(result))); | 596 "Failed to load Blob: error code = " + net::ErrorToString(result))); |
597 // |this| is destroyed here. | 597 // |this| is destroyed here. |
598 return; | 598 return; |
599 } | 599 } |
600 } | 600 } |
601 | 601 |
602 } // namespace content | 602 } // namespace content |
OLD | NEW |