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

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: (rebase) Created 4 years, 5 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 return 0; 273 return 0;
274 } 274 }
275 275
276 static void writeImageToDataObject(DataObject* dataObject, Element* element, con st KURL& url) 276 static void writeImageToDataObject(DataObject* dataObject, Element* element, con st KURL& url)
277 { 277 {
278 // Shove image data into a DataObject for use as a file 278 // Shove image data into a DataObject for use as a file
279 ImageResource* cachedImage = getImageResource(element); 279 ImageResource* cachedImage = getImageResource(element);
280 if (!cachedImage || !cachedImage->getImage() || !cachedImage->isLoaded()) 280 if (!cachedImage || !cachedImage->getImage() || !cachedImage->isLoaded())
281 return; 281 return;
282 282
283 SharedBuffer* imageBuffer = cachedImage->getImage()->data(); 283 RefPtr<SharedBuffer> imageBuffer = cachedImage->getImage()->data();
284 if (!imageBuffer || !imageBuffer->size()) 284 if (!imageBuffer || !imageBuffer->size())
285 return; 285 return;
286 286
287 String imageExtension = cachedImage->getImage()->filenameExtension(); 287 String imageExtension = cachedImage->getImage()->filenameExtension();
288 ASSERT(!imageExtension.isEmpty()); 288 ASSERT(!imageExtension.isEmpty());
289 289
290 // Determine the filename for the file contents of the image. 290 // Determine the filename for the file contents of the image.
291 String filename = cachedImage->response().suggestedFilename(); 291 String filename = cachedImage->response().suggestedFilename();
292 if (filename.isEmpty()) 292 if (filename.isEmpty())
293 filename = url.lastPathComponent(); 293 filename = url.lastPathComponent();
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 } 510 }
511 511
512 DEFINE_TRACE(DataTransfer) 512 DEFINE_TRACE(DataTransfer)
513 { 513 {
514 visitor->trace(m_dataObject); 514 visitor->trace(m_dataObject);
515 visitor->trace(m_dragImage); 515 visitor->trace(m_dragImage);
516 visitor->trace(m_dragImageElement); 516 visitor->trace(m_dragImageElement);
517 } 517 }
518 518
519 } // namespace blink 519 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp ('k') | third_party/WebKit/Source/core/fetch/ImageResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698