| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/devtools/protocol/io_handler.h" | 5 #include "content/browser/devtools/protocol/io_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace io { | 21 namespace io { |
| 22 | 22 |
| 23 using Response = DevToolsProtocolClient::Response; | 23 using Response = DevToolsProtocolClient::Response; |
| 24 | 24 |
| 25 IOHandler::IOHandler(DevToolsIOContext* io_context) | 25 IOHandler::IOHandler(DevToolsIOContext* io_context) |
| 26 : io_context_(io_context) | 26 : io_context_(io_context) |
| 27 , weak_factory_(this) {} | 27 , weak_factory_(this) {} |
| 28 | 28 |
| 29 IOHandler::~IOHandler() {} | 29 IOHandler::~IOHandler() {} |
| 30 | 30 |
| 31 void IOHandler::SetClient(scoped_ptr<Client> client) { | 31 void IOHandler::SetClient(std::unique_ptr<Client> client) { |
| 32 client_.swap(client); | 32 client_.swap(client); |
| 33 } | 33 } |
| 34 | 34 |
| 35 Response IOHandler::Read(DevToolsCommandId command_id, | 35 Response IOHandler::Read(DevToolsCommandId command_id, |
| 36 const std::string& handle, const int* offset, const int* max_size) { | 36 const std::string& handle, const int* offset, const int* max_size) { |
| 37 static const size_t kDefaultChunkSize = 10 * 1024 * 1024; | 37 static const size_t kDefaultChunkSize = 10 * 1024 * 1024; |
| 38 | 38 |
| 39 scoped_refptr<DevToolsIOContext::Stream> stream = | 39 scoped_refptr<DevToolsIOContext::Stream> stream = |
| 40 io_context_->GetByHandle(handle); | 40 io_context_->GetByHandle(handle); |
| 41 if (!stream) | 41 if (!stream) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 Response IOHandler::Close(const std::string& handle) { | 62 Response IOHandler::Close(const std::string& handle) { |
| 63 return io_context_->Close(handle) ? Response::OK() | 63 return io_context_->Close(handle) ? Response::OK() |
| 64 : Response::InvalidParams("Invalid stream handle"); | 64 : Response::InvalidParams("Invalid stream handle"); |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace io | 67 } // namespace io |
| 68 } // namespace devtools | 68 } // namespace devtools |
| 69 } // namespace content | 69 } // namespace content |
| OLD | NEW |