Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1206)

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 831903004: [WebView] Add a new flushVisualState API to AwContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clarify comment Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index af0c6fcc9a43af5997fc99815ca11e7f44696bee..50f7fc5f70f8e72abd88500ae132a3514e5186d4 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -179,6 +179,10 @@ RenderFrameHostImpl::~RenderFrameHostImpl() {
// NULL out the swapout timer; in crash dumps this member will be null only if
// the dtor has run.
swapout_event_monitor_timeout_.reset();
+
+ for(const auto& iter: flush_visual_state_callbacks_) {
+ iter.second.Run(false);
+ }
}
int RenderFrameHostImpl::GetRoutingID() {
@@ -316,6 +320,8 @@ bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) {
IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu)
IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse,
OnJavaScriptExecuteResponse)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_FlushVisualStateResponse,
+ OnFlushVisualStateResponse)
IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage,
OnRunJavaScriptMessage)
IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm,
@@ -933,6 +939,16 @@ void RenderFrameHostImpl::OnJavaScriptExecuteResponse(
}
}
+void RenderFrameHostImpl::OnFlushVisualStateResponse(int id) {
+ auto it = flush_visual_state_callbacks_.find(id);
+ if (it != flush_visual_state_callbacks_.end()) {
+ it->second.Run(true);
+ flush_visual_state_callbacks_.erase(it);
+ } else {
+ NOTREACHED() << "Received script response for unknown request";
+ }
+}
+
void RenderFrameHostImpl::OnRunJavaScriptMessage(
const base::string16& message,
const base::string16& default_prompt,
@@ -1516,6 +1532,14 @@ void RenderFrameHostImpl::ActivateFindInPageResultForAccessibility(
}
}
+void RenderFrameHostImpl::FlushVisualState(
+ const FlushVisualStateResultCallback& callback) {
+ static int next_id = 1;
mkosiba (inactive) 2015/01/14 18:17:12 or maybe uint64 to be extra safe :P
Ignacio Solla 2015/01/16 16:02:07 Done.
+ int key = next_id++;
+ Send(new FrameMsg_FlushVisualStateRequest(routing_id_, key));
+ flush_visual_state_callbacks_.insert(std::make_pair(key, callback));
+}
+
#if defined(OS_WIN)
void RenderFrameHostImpl::SetParentNativeViewAccessible(

Powered by Google App Engine
This is Rietveld 408576698