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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalFrame.cpp

Issue 1841833002: Deal gracefully with null {GraphicsContext,SkPictureBuilder}.endRecording() results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 120 }
121 121
122 GraphicsContext& context() { return m_pictureBuilder->context(); } 122 GraphicsContext& context() { return m_pictureBuilder->context(); }
123 123
124 PassOwnPtr<DragImage> createImage() 124 PassOwnPtr<DragImage> createImage()
125 { 125 {
126 if (m_draggedNode && m_draggedNode->layoutObject()) 126 if (m_draggedNode && m_draggedNode->layoutObject())
127 m_draggedNode->layoutObject()->updateDragState(false); 127 m_draggedNode->layoutObject()->updateDragState(false);
128 context().getPaintController().endItem<EndTransformDisplayItem>(*m_local Frame); 128 context().getPaintController().endItem<EndTransformDisplayItem>(*m_local Frame);
129 RefPtr<const SkPicture> recording = m_pictureBuilder->endRecording(); 129 RefPtr<const SkPicture> recording = m_pictureBuilder->endRecording();
130 if (!recording)
chrishtr 2016/03/29 22:42:23 Did you check call sites to be robust aginst nullp
wkorman 2016/03/29 22:52:02 Yes.
131 return nullptr;
132
130 RefPtr<SkImage> skImage = adoptRef(SkImage::NewFromPicture(recording.get (), 133 RefPtr<SkImage> skImage = adoptRef(SkImage::NewFromPicture(recording.get (),
131 SkISize::Make(m_bounds.width(), m_bounds.height()), nullptr, nullptr )); 134 SkISize::Make(m_bounds.width(), m_bounds.height()), nullptr, nullptr ));
132 RefPtr<Image> image = StaticBitmapImage::create(skImage.release()); 135 RefPtr<Image> image = StaticBitmapImage::create(skImage.release());
133 RespectImageOrientationEnum imageOrientation = DoNotRespectImageOrientat ion; 136 RespectImageOrientationEnum imageOrientation = DoNotRespectImageOrientat ion;
134 if (m_draggedNode && m_draggedNode->layoutObject()) 137 if (m_draggedNode && m_draggedNode->layoutObject())
135 imageOrientation = LayoutObject::shouldRespectImageOrientation(m_dra ggedNode->layoutObject()); 138 imageOrientation = LayoutObject::shouldRespectImageOrientation(m_dra ggedNode->layoutObject());
136 139
137 float screenDeviceScaleFactor = m_localFrame->page()->chromeClient().scr eenInfo().deviceScaleFactor; 140 float screenDeviceScaleFactor = m_localFrame->page()->chromeClient().scr eenInfo().deviceScaleFactor;
138 141
139 return DragImage::create(image.get(), imageOrientation, screenDeviceScal eFactor, InterpolationHigh, m_opacity); 142 return DragImage::create(image.get(), imageOrientation, screenDeviceScal eFactor, InterpolationHigh, m_opacity);
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 { 878 {
876 m_frame->disableNavigation(); 879 m_frame->disableNavigation();
877 } 880 }
878 881
879 FrameNavigationDisabler::~FrameNavigationDisabler() 882 FrameNavigationDisabler::~FrameNavigationDisabler()
880 { 883 {
881 m_frame->enableNavigation(); 884 m_frame->enableNavigation();
882 } 885 }
883 886
884 } // namespace blink 887 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698