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" |
11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/memory/ref_counted_delete_on_message_loop.h" | 13 #include "base/memory/ref_counted_delete_on_message_loop.h" |
14 #include "base/memory/ref_counted_memory.h" | 14 #include "base/memory/ref_counted_memory.h" |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "content/browser/devtools/devtools_io_context.h" | 16 #include "content/browser/devtools/devtools_io_context.h" |
17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 namespace protocol { | 20 namespace protocol { |
21 | 21 |
22 IOHandler::IOHandler(DevToolsIOContext* io_context) | 22 IOHandler::IOHandler(DevToolsIOContext* io_context) |
23 : io_context_(io_context) | 23 : DevToolsDomainHandler(IO::Metainfo::domainName), |
| 24 io_context_(io_context) |
24 , weak_factory_(this) {} | 25 , weak_factory_(this) {} |
25 | 26 |
26 IOHandler::~IOHandler() {} | 27 IOHandler::~IOHandler() {} |
27 | 28 |
28 void IOHandler::Wire(UberDispatcher* dispatcher) { | 29 void IOHandler::Wire(UberDispatcher* dispatcher) { |
29 frontend_.reset(new IO::Frontend(dispatcher->channel())); | 30 frontend_.reset(new IO::Frontend(dispatcher->channel())); |
30 IO::Dispatcher::wire(dispatcher, this); | 31 IO::Dispatcher::wire(dispatcher, this); |
31 } | 32 } |
32 | 33 |
| 34 void IOHandler::SetRenderFrameHost(RenderFrameHostImpl* host) { |
| 35 } |
| 36 |
33 Response IOHandler::Disable() { | 37 Response IOHandler::Disable() { |
34 return Response::OK(); | 38 return Response::OK(); |
35 } | 39 } |
36 | 40 |
37 void IOHandler::Read( | 41 void IOHandler::Read( |
38 const std::string& handle, | 42 const std::string& handle, |
39 Maybe<int> offset, | 43 Maybe<int> offset, |
40 Maybe<int> max_size, | 44 Maybe<int> max_size, |
41 std::unique_ptr<ReadCallback> callback) { | 45 std::unique_ptr<ReadCallback> callback) { |
42 static const size_t kDefaultChunkSize = 10 * 1024 * 1024; | 46 static const size_t kDefaultChunkSize = 10 * 1024 * 1024; |
(...skipping 22 matching lines...) Expand all Loading... |
65 callback->sendSuccess(data->data(), eof); | 69 callback->sendSuccess(data->data(), eof); |
66 } | 70 } |
67 | 71 |
68 Response IOHandler::Close(const std::string& handle) { | 72 Response IOHandler::Close(const std::string& handle) { |
69 return io_context_->Close(handle) ? Response::OK() | 73 return io_context_->Close(handle) ? Response::OK() |
70 : Response::InvalidParams("Invalid stream handle"); | 74 : Response::InvalidParams("Invalid stream handle"); |
71 } | 75 } |
72 | 76 |
73 } // namespace protocol | 77 } // namespace protocol |
74 } // namespace content | 78 } // namespace content |
OLD | NEW |