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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 1408873002: Ignore InputMsg IPCs if RenderView is in swapped out state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes based on Alex's review. Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 const blink::WebActiveWheelFlingParameters& params) { 1269 const blink::WebActiveWheelFlingParameters& params) {
1270 if (webview()) 1270 if (webview())
1271 webview()->transferActiveWheelFlingAnimation(params); 1271 webview()->transferActiveWheelFlingAnimation(params);
1272 } 1272 }
1273 1273
1274 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { 1274 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) {
1275 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; 1275 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL;
1276 if (main_frame && main_frame->isWebLocalFrame()) 1276 if (main_frame && main_frame->isWebLocalFrame())
1277 GetContentClient()->SetActiveURL(main_frame->document().url()); 1277 GetContentClient()->SetActiveURL(main_frame->document().url());
1278 1278
1279 // Input IPC messages must not be processed if the RenderView is in
1280 // swapped out state.
1281 if (is_swapped_out_ && IPC_MESSAGE_ID_CLASS(message.type()) == InputMsgStart)
1282 return false;
1283
1279 base::ObserverListBase<RenderViewObserver>::Iterator it(&observers_); 1284 base::ObserverListBase<RenderViewObserver>::Iterator it(&observers_);
1280 RenderViewObserver* observer; 1285 RenderViewObserver* observer;
1281 while ((observer = it.GetNext()) != NULL) 1286 while ((observer = it.GetNext()) != NULL)
1282 if (observer->OnMessageReceived(message)) 1287 if (observer->OnMessageReceived(message))
1283 return true; 1288 return true;
1284 1289
1285 bool handled = true; 1290 bool handled = true;
1286 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) 1291 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message)
1287 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) 1292 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand)
1288 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) 1293 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret)
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
3059 3064
3060 GURL RenderViewImpl::GetURLForGraphicsContext3D() { 3065 GURL RenderViewImpl::GetURLForGraphicsContext3D() {
3061 DCHECK(webview()); 3066 DCHECK(webview());
3062 if (webview()->mainFrame()->isWebLocalFrame()) 3067 if (webview()->mainFrame()->isWebLocalFrame())
3063 return GURL(webview()->mainFrame()->document().url()); 3068 return GURL(webview()->mainFrame()->document().url());
3064 else 3069 else
3065 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); 3070 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D");
3066 } 3071 }
3067 3072
3068 void RenderViewImpl::OnSetFocus(bool enable) { 3073 void RenderViewImpl::OnSetFocus(bool enable) {
3074 // This message must always be received when the main frame is a
3075 // WebLocalFrame.
3076 CHECK(webview()->mainFrame()->isWebLocalFrame());
3069 RenderWidget::OnSetFocus(enable); 3077 RenderWidget::OnSetFocus(enable);
3070 3078
3071 #if defined(ENABLE_PLUGINS) 3079 #if defined(ENABLE_PLUGINS)
3072 if (webview() && webview()->isActive()) { 3080 if (webview() && webview()->isActive()) {
3073 // Notify all NPAPI plugins. 3081 // Notify all NPAPI plugins.
3074 std::set<WebPluginDelegateProxy*>::iterator plugin_it; 3082 std::set<WebPluginDelegateProxy*>::iterator plugin_it;
3075 for (plugin_it = plugin_delegates_.begin(); 3083 for (plugin_it = plugin_delegates_.begin();
3076 plugin_it != plugin_delegates_.end(); ++plugin_it) { 3084 plugin_it != plugin_delegates_.end(); ++plugin_it) {
3077 #if defined(OS_MACOSX) 3085 #if defined(OS_MACOSX)
3078 // RenderWidget's call to setFocus can cause the underlying webview's 3086 // RenderWidget's call to setFocus can cause the underlying webview's
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
3682 std::vector<gfx::Size> sizes; 3690 std::vector<gfx::Size> sizes;
3683 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 3691 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
3684 if (!url.isEmpty()) 3692 if (!url.isEmpty())
3685 urls.push_back( 3693 urls.push_back(
3686 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 3694 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
3687 } 3695 }
3688 SendUpdateFaviconURL(urls); 3696 SendUpdateFaviconURL(urls);
3689 } 3697 }
3690 3698
3691 } // namespace content 3699 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698