Chromium Code Reviews| Index: content/browser/devtools/devtools_session.h |
| diff --git a/content/browser/devtools/devtools_session.h b/content/browser/devtools/devtools_session.h |
| index 24909914ef6d85da6de94b6494cfd3af3dc23198..1cf2bf72c02115b26094acc473a20091346ff6fa 100644 |
| --- a/content/browser/devtools/devtools_session.h |
| +++ b/content/browser/devtools/devtools_session.h |
| @@ -5,6 +5,8 @@ |
| #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_SESSION_H_ |
| #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_SESSION_H_ |
| +#include <unordered_map> |
|
caseq
2017/06/13 19:52:26
consider using regular maps? see https://groups.go
dgozman
2017/06/16 17:58:46
Done.
|
| + |
| #include "base/containers/flat_map.h" |
| #include "base/memory/weak_ptr.h" |
| #include "base/values.h" |
| @@ -29,10 +31,19 @@ class DevToolsSession : public protocol::FrontendChannel { |
| void SetRenderFrameHost(RenderFrameHostImpl* host); |
| void SetFallThroughForNotFound(bool value); |
| + struct Message { |
| + std::string method; |
| + std::string message; |
| + }; |
| + using MessageByCallId = std::unordered_map<int, Message>; |
| + MessageByCallId& waiting_messages() { return waiting_for_response_messages_; } |
| + const std::string& state_cookie() { return chunk_processor_.state_cookie(); } |
| + |
| protocol::Response::Status Dispatch( |
| const std::string& message, |
| int* call_id, |
| std::string* method); |
| + bool ReceiveMessageChunk(const DevToolsMessageChunk& chunk); |
| // Only used by DevToolsAgentHostImpl. |
| DevToolsAgentHostClient* client() const { return client_; } |
| @@ -53,7 +64,9 @@ class DevToolsSession : public protocol::FrontendChannel { |
| } |
| private: |
| - void sendResponse(std::unique_ptr<base::DictionaryValue> response); |
| + void SendMessageToClient(int session_id, const std::string& message); |
| + void SendResponse(std::unique_ptr<base::DictionaryValue> response); |
| + |
| // protocol::FrontendChannel implementation. |
| void sendProtocolResponse( |
| int call_id, |
| @@ -69,6 +82,10 @@ class DevToolsSession : public protocol::FrontendChannel { |
| handlers_; |
| RenderFrameHostImpl* host_; |
| std::unique_ptr<protocol::UberDispatcher> dispatcher_; |
| + // Chunk processor's state cookie always corresponds to a state before |
| + // any of the waiting for response messages have been handled. |
| + DevToolsMessageChunkProcessor chunk_processor_; |
| + MessageByCallId waiting_for_response_messages_; |
|
caseq
2017/06/13 19:52:26
nit: messages_waiting_for_response_?
dgozman
2017/06/16 17:58:46
Acknowledged.
|
| base::WeakPtrFactory<DevToolsSession> weak_factory_; |
| }; |