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

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

Issue 1776133003: Have DataObject create less copies of mime type lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iwyu Created 4 years, 9 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 | « third_party/WebKit/Source/core/clipboard/DataObject.cpp ('k') | 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 /* 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 m_dataObject->setData(normalizeType(type), data); 182 m_dataObject->setData(normalizeType(type), data);
183 } 183 }
184 184
185 // extensions beyond IE's API 185 // extensions beyond IE's API
186 Vector<String> DataTransfer::types() const 186 Vector<String> DataTransfer::types() const
187 { 187 {
188 Vector<String> types; 188 Vector<String> types;
189 if (!canReadTypes()) 189 if (!canReadTypes())
190 return types; 190 return types;
191 191
192 ListHashSet<String> typesSet = m_dataObject->types(); 192 return m_dataObject->types();
193 types.appendRange(typesSet.begin(), typesSet.end());
194 return types;
195 } 193 }
196 194
197 FileList* DataTransfer::files() const 195 FileList* DataTransfer::files() const
198 { 196 {
199 FileList* files = FileList::create(); 197 FileList* files = FileList::create();
200 if (!canReadData()) 198 if (!canReadData())
201 return files; 199 return files;
202 200
203 for (size_t i = 0; i < m_dataObject->length(); ++i) { 201 for (size_t i = 0; i < m_dataObject->length(); ++i) {
204 if (m_dataObject->item(i)->kind() == DataObjectItem::FileKind) { 202 if (m_dataObject->item(i)->kind() == DataObjectItem::FileKind) {
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 DEFINE_TRACE(DataTransfer) 511 DEFINE_TRACE(DataTransfer)
514 { 512 {
515 visitor->trace(m_dataObject); 513 visitor->trace(m_dataObject);
516 visitor->trace(m_dragImage); 514 visitor->trace(m_dragImage);
517 #if ENABLE(OILPAN) 515 #if ENABLE(OILPAN)
518 visitor->trace(m_dragImageElement); 516 visitor->trace(m_dragImageElement);
519 #endif 517 #endif
520 } 518 }
521 519
522 } // namespace blink 520 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/clipboard/DataObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698