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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ImageResource.cpp

Issue 2253853002: Remove SharedBuffer::unlock() and keep Resource's SharedBuffer always locked (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 return std::make_pair(brokenImageLoRes, 1); 268 return std::make_pair(brokenImageLoRes, 1);
269 } 269 }
270 270
271 bool ImageResource::willPaintBrokenImage() const 271 bool ImageResource::willPaintBrokenImage() const
272 { 272 {
273 return errorOccurred(); 273 return errorOccurred();
274 } 274 }
275 275
276 blink::Image* ImageResource::getImage() 276 blink::Image* ImageResource::getImage()
277 { 277 {
278 ASSERT(!isPurgeable());
279
280 if (errorOccurred()) { 278 if (errorOccurred()) {
281 // Returning the 1x broken image is non-ideal, but we cannot reliably ac cess the appropriate 279 // Returning the 1x broken image is non-ideal, but we cannot reliably ac cess the appropriate
282 // deviceScaleFactor from here. It is critical that callers use ImageRes ource::brokenImage() 280 // deviceScaleFactor from here. It is critical that callers use ImageRes ource::brokenImage()
283 // when they need the real, deviceScaleFactor-appropriate broken image i con. 281 // when they need the real, deviceScaleFactor-appropriate broken image i con.
284 return brokenImage(1).first; 282 return brokenImage(1).first;
285 } 283 }
286 284
287 if (m_image) 285 if (m_image)
288 return m_image.get(); 286 return m_image.get();
289 287
(...skipping 11 matching lines...) Expand all
301 bool ImageResource::imageHasRelativeSize() const 299 bool ImageResource::imageHasRelativeSize() const
302 { 300 {
303 if (m_image) 301 if (m_image)
304 return m_image->hasRelativeSize(); 302 return m_image->hasRelativeSize();
305 303
306 return false; 304 return false;
307 } 305 }
308 306
309 LayoutSize ImageResource::imageSize(RespectImageOrientationEnum shouldRespectIma geOrientation, float multiplier, SizeType sizeType) 307 LayoutSize ImageResource::imageSize(RespectImageOrientationEnum shouldRespectIma geOrientation, float multiplier, SizeType sizeType)
310 { 308 {
311 ASSERT(!isPurgeable());
312
313 if (!m_image) 309 if (!m_image)
314 return LayoutSize(); 310 return LayoutSize();
315 311
316 LayoutSize size; 312 LayoutSize size;
317 313
318 if (m_image->isBitmapImage() && shouldRespectImageOrientation == RespectImag eOrientation) 314 if (m_image->isBitmapImage() && shouldRespectImageOrientation == RespectImag eOrientation)
319 size = LayoutSize(toBitmapImage(m_image.get())->sizeRespectingOrientatio n()); 315 size = LayoutSize(toBitmapImage(m_image.get())->sizeRespectingOrientatio n());
320 else 316 else
321 size = LayoutSize(m_image->size()); 317 size = LayoutSize(m_image->size());
322 318
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 if (response().wasFetchedViaServiceWorker()) 594 if (response().wasFetchedViaServiceWorker())
599 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; 595 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque;
600 if (!getImage()->currentFrameHasSingleSecurityOrigin()) 596 if (!getImage()->currentFrameHasSingleSecurityOrigin())
601 return false; 597 return false;
602 if (passesAccessControlCheck(securityOrigin)) 598 if (passesAccessControlCheck(securityOrigin))
603 return true; 599 return true;
604 return !securityOrigin->taintsCanvas(response().url()); 600 return !securityOrigin->taintsCanvas(response().url());
605 } 601 }
606 602
607 } // namespace blink 603 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698