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

Side by Side Diff: third_party/WebKit/Source/core/clipboard/DataTransfer.cpp

Issue 2054643003: Remove duplication of encoded image data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bug fix: m_image should not be cleared Created 4 years, 6 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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 return 0; 272 return 0;
273 } 273 }
274 274
275 static void writeImageToDataObject(DataObject* dataObject, Element* element, con st KURL& url) 275 static void writeImageToDataObject(DataObject* dataObject, Element* element, con st KURL& url)
276 { 276 {
277 // Shove image data into a DataObject for use as a file 277 // Shove image data into a DataObject for use as a file
278 ImageResource* cachedImage = getImageResource(element); 278 ImageResource* cachedImage = getImageResource(element);
279 if (!cachedImage || !cachedImage->getImage() || !cachedImage->isLoaded()) 279 if (!cachedImage || !cachedImage->getImage() || !cachedImage->isLoaded())
280 return; 280 return;
281 281
282 SharedBuffer* imageBuffer = cachedImage->getImage()->data(); 282 RefPtr<SharedBuffer> imageBuffer = cachedImage->getImage()->data();
283 if (!imageBuffer || !imageBuffer->size()) 283 if (!imageBuffer || !imageBuffer->size())
284 return; 284 return;
285 285
286 String imageExtension = cachedImage->getImage()->filenameExtension(); 286 String imageExtension = cachedImage->getImage()->filenameExtension();
287 ASSERT(!imageExtension.isEmpty()); 287 ASSERT(!imageExtension.isEmpty());
288 288
289 // Determine the filename for the file contents of the image. 289 // Determine the filename for the file contents of the image.
290 String filename = cachedImage->response().suggestedFilename(); 290 String filename = cachedImage->response().suggestedFilename();
291 if (filename.isEmpty()) 291 if (filename.isEmpty())
292 filename = url.lastPathComponent(); 292 filename = url.lastPathComponent();
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 509 }
510 510
511 DEFINE_TRACE(DataTransfer) 511 DEFINE_TRACE(DataTransfer)
512 { 512 {
513 visitor->trace(m_dataObject); 513 visitor->trace(m_dataObject);
514 visitor->trace(m_dragImage); 514 visitor->trace(m_dragImage);
515 visitor->trace(m_dragImageElement); 515 visitor->trace(m_dragImageElement);
516 } 516 }
517 517
518 } // namespace blink 518 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698