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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1355513003: Adds NULL checks in RenderFrameHostImpl::GetVisibilityState(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 371
372 RenderViewHost* RenderFrameHostImpl::GetRenderViewHost() { 372 RenderViewHost* RenderFrameHostImpl::GetRenderViewHost() {
373 return render_view_host_; 373 return render_view_host_;
374 } 374 }
375 375
376 ServiceRegistry* RenderFrameHostImpl::GetServiceRegistry() { 376 ServiceRegistry* RenderFrameHostImpl::GetServiceRegistry() {
377 return service_registry_.get(); 377 return service_registry_.get();
378 } 378 }
379 379
380 blink::WebPageVisibilityState RenderFrameHostImpl::GetVisibilityState() { 380 blink::WebPageVisibilityState RenderFrameHostImpl::GetVisibilityState() {
381 // Works around the crashes seen in https://crbug.com/501863, where the
382 // active WebContents from a browser iterator may contain a render frame
383 // detached from the frame tree.
384 RenderWidgetHostView* view = RenderFrameHostImpl::GetView();
385 if (!view || !view->GetRenderWidgetHost())
386 return blink::WebPageVisibilityStateHidden;
387
381 // TODO(mlamouri,kenrb): call GetRenderWidgetHost() directly when it stops 388 // TODO(mlamouri,kenrb): call GetRenderWidgetHost() directly when it stops
382 // returning nullptr in some cases. See https://crbug.com/455245. 389 // returning nullptr in some cases. See https://crbug.com/455245.
383 blink::WebPageVisibilityState visibility_state = 390 blink::WebPageVisibilityState visibility_state =
384 RenderWidgetHostImpl::From(GetView()->GetRenderWidgetHost())->is_hidden() 391 RenderWidgetHostImpl::From(view->GetRenderWidgetHost())->is_hidden()
385 ? blink::WebPageVisibilityStateHidden 392 ? blink::WebPageVisibilityStateHidden
386 : blink::WebPageVisibilityStateVisible; 393 : blink::WebPageVisibilityStateVisible;
387 GetContentClient()->browser()->OverridePageVisibilityState(this, 394 GetContentClient()->browser()->OverridePageVisibilityState(this,
388 &visibility_state); 395 &visibility_state);
389 return visibility_state; 396 return visibility_state;
390 } 397 }
391 398
392 bool RenderFrameHostImpl::Send(IPC::Message* message) { 399 bool RenderFrameHostImpl::Send(IPC::Message* message) {
393 if (IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart) { 400 if (IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart) {
394 return render_view_host_->input_router()->SendInput( 401 return render_view_host_->input_router()->SendInput(
(...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 BrowserPluginInstanceIDToAXTreeID(value))); 2249 BrowserPluginInstanceIDToAXTreeID(value)));
2243 break; 2250 break;
2244 case AX_CONTENT_INT_ATTRIBUTE_LAST: 2251 case AX_CONTENT_INT_ATTRIBUTE_LAST:
2245 NOTREACHED(); 2252 NOTREACHED();
2246 break; 2253 break;
2247 } 2254 }
2248 } 2255 }
2249 } 2256 }
2250 2257
2251 } // namespace content 2258 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698