Index: content/browser/frame_host/navigation_handle_impl.h |
diff --git a/content/browser/frame_host/navigation_handle_impl.h b/content/browser/frame_host/navigation_handle_impl.h |
index b212b3ee7a7a0c3ac01fca8a1175370a26b99844..31251004c2d93bdfa11098b315dd413d79eb0b1a 100644 |
--- a/content/browser/frame_host/navigation_handle_impl.h |
+++ b/content/browser/frame_host/navigation_handle_impl.h |
@@ -18,6 +18,7 @@ |
#include "content/common/content_export.h" |
#include "content/public/browser/navigation_data.h" |
#include "content/public/browser/navigation_throttle.h" |
+#include "content/public/common/console_message_level.h" |
#include "url/gurl.h" |
struct FrameHostMsg_DidCommitProvisionalLoad_Params; |
@@ -233,6 +234,13 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { |
navigation_data_ = std::move(navigation_data); |
} |
+ // Adds a console message to the NavigationHandle's message queue. Messages |
+ // queued before the navigation is ready to commit will be delivered to the |
+ // final RenderFrameHost upon commit. Messages queued after the navigation has |
+ // committed will be delivered immediately. |
clamy
2016/06/29 11:07:28
The navigation commit corresponds to the destructi
|
+ void QueueConsoleMessage(ConsoleMessageLevel level, |
nasko
2016/06/28 22:25:46
bikeshed: AppendConsoleMessage? Queue to me implie
|
+ const std::string& message); |
+ |
private: |
friend class NavigationHandleImplTest; |
@@ -267,6 +275,12 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { |
// end of a round of NavigationThrottleChecks. |
void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); |
+ // Outputs the messages in |console_queue_| to the relevant RenderFrameHost, |
+ // in FIFO order. This method must be called after a response has been |
+ // delivered for processing, and will clear out |console_queue_| as a side |
+ // effect of sending the messages. |
+ virtual void DumpMessagesToConsole(); |
clamy
2016/06/29 11:07:28
Why virtual?
|
+ |
// Used in tests. |
State state() const { return state_; } |
@@ -326,6 +340,9 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { |
// Embedder data tied to this navigation. |
std::unique_ptr<NavigationData> navigation_data_; |
+ // A queue of messages to be delivered to the devtools console upon commit. |
+ std::queue<std::pair<ConsoleMessageLevel, const std::string>> console_queue_; |
+ |
DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
}; |