| Index: third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp
|
| diff --git a/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp b/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp
|
| index 32d1c9683c85f25157b6b53ebee80719f089dae9..284df2193b86ac74f1f736c295037a424bee0858 100644
|
| --- a/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp
|
| +++ b/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp
|
| @@ -29,12 +29,14 @@ namespace blink {
|
|
|
| DOMPluginArray::DOMPluginArray(LocalFrame* frame)
|
| : DOMWindowProperty(frame)
|
| + , m_modified(0)
|
| {
|
| }
|
|
|
| DEFINE_TRACE(DOMPluginArray)
|
| {
|
| DOMWindowProperty::trace(visitor);
|
| + visitor->trace(m_plugins);
|
| }
|
|
|
| unsigned DOMPluginArray::length() const
|
| @@ -45,6 +47,20 @@ unsigned DOMPluginArray::length() const
|
| return data->plugins().size();
|
| }
|
|
|
| +DOMPlugin* DOMPluginArray::getPlugin(unsigned index)
|
| +{
|
| + PluginData* data = pluginData();
|
| + if (!data)
|
| + return nullptr;
|
| + if (data->modified() != m_modified) {
|
| + m_plugins.clear();
|
| + m_modified = data->modified();
|
| + }
|
| + if (m_plugins.find(index) == m_plugins.end())
|
| + m_plugins.add(index, DOMPlugin::create(data, m_frame, index));
|
| + return m_plugins.get(index);
|
| +}
|
| +
|
| DOMPlugin* DOMPluginArray::item(unsigned index)
|
| {
|
| PluginData* data = pluginData();
|
| @@ -53,7 +69,7 @@ DOMPlugin* DOMPluginArray::item(unsigned index)
|
| const Vector<PluginInfo>& plugins = data->plugins();
|
| if (index >= plugins.size())
|
| return nullptr;
|
| - return DOMPlugin::create(data, m_frame, index);
|
| + return getPlugin(index);
|
| }
|
|
|
| DOMPlugin* DOMPluginArray::namedItem(const AtomicString& propertyName)
|
| @@ -64,7 +80,7 @@ DOMPlugin* DOMPluginArray::namedItem(const AtomicString& propertyName)
|
| const Vector<PluginInfo>& plugins = data->plugins();
|
| for (unsigned i = 0; i < plugins.size(); ++i) {
|
| if (plugins[i].name == propertyName)
|
| - return DOMPlugin::create(data, m_frame, i);
|
| + return getPlugin(i);
|
| }
|
| return nullptr;
|
| }
|
|
|