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

Side by Side Diff: third_party/WebKit/Source/modules/plugins/DOMPlugin.cpp

Issue 2157883002: Cache the mimeTypes and plugins DOM objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated after dry run. Created 4 years, 3 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) 2008 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public 5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details. 12 * Lesser General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Lesser General Public 14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software 15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U SA 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U SA
17 */ 17 */
18 18
19 #include "modules/plugins/DOMPlugin.h" 19 #include "modules/plugins/DOMPlugin.h"
20 20
21 #include "core/frame/LocalDOMWindow.h"
22 #include "modules/plugins/DOMMimeTypeArray.h"
23 #include "modules/plugins/NavigatorPlugins.h"
21 #include "platform/plugins/PluginData.h" 24 #include "platform/plugins/PluginData.h"
25
22 #include "wtf/text/AtomicString.h" 26 #include "wtf/text/AtomicString.h"
23 27
24 namespace blink { 28 namespace blink {
25 29
26 DOMPlugin::DOMPlugin(PluginData* pluginData, LocalFrame* frame, unsigned index) 30 DOMPlugin::DOMPlugin(PluginData* pluginData, LocalFrame* frame, unsigned index)
27 : DOMWindowProperty(frame) 31 : DOMWindowProperty(frame)
28 , m_pluginData(pluginData) 32 , m_pluginData(pluginData)
29 , m_index(index) 33 , m_index(index)
30 { 34 {
31 } 35 }
(...skipping 30 matching lines...) Expand all
62 DOMMimeType* DOMPlugin::item(unsigned index) 66 DOMMimeType* DOMPlugin::item(unsigned index)
63 { 67 {
64 if (index >= pluginInfo().mimes.size()) 68 if (index >= pluginInfo().mimes.size())
65 return nullptr; 69 return nullptr;
66 70
67 const MimeClassInfo& mime = pluginInfo().mimes[index]; 71 const MimeClassInfo& mime = pluginInfo().mimes[index];
68 72
69 const Vector<MimeClassInfo>& mimes = m_pluginData->mimes(); 73 const Vector<MimeClassInfo>& mimes = m_pluginData->mimes();
70 for (unsigned i = 0; i < mimes.size(); ++i) { 74 for (unsigned i = 0; i < mimes.size(); ++i) {
71 if (mimes[i] == mime && m_pluginData->mimePluginIndices()[i] == m_index) 75 if (mimes[i] == mime && m_pluginData->mimePluginIndices()[i] == m_index)
72 return DOMMimeType::create(m_pluginData.get(), frame(), i); 76 return NavigatorPlugins::mimeTypes(*frame()->domWindow()->navigator( ))->getMimeType(i);
73 } 77 }
74 return nullptr; 78 return nullptr;
75 } 79 }
76 80
77 DOMMimeType* DOMPlugin::namedItem(const AtomicString& propertyName) 81 DOMMimeType* DOMPlugin::namedItem(const AtomicString& propertyName)
78 { 82 {
79 const Vector<MimeClassInfo>& mimes = m_pluginData->mimes(); 83 const Vector<MimeClassInfo>& mimes = m_pluginData->mimes();
80 for (unsigned i = 0; i < mimes.size(); ++i) { 84 for (unsigned i = 0; i < mimes.size(); ++i) {
81 if (mimes[i].type == propertyName) 85 if (mimes[i].type == propertyName)
82 return DOMMimeType::create(m_pluginData.get(), frame(), i); 86 return NavigatorPlugins::mimeTypes(*frame()->domWindow()->navigator( ))->getMimeType(i);
83 } 87 }
84 return nullptr; 88 return nullptr;
85 } 89 }
86 90
87 } // namespace blink 91 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698