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

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

Issue 2901353002: Move blink::PluginData, blink::PluginInfo, blink::MimeTypeInfo to oilpan heap. (Closed)
Patch Set: nits, remove dead code Created 3 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) 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, 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA 17 * MA 02110-1301 USA
18 */ 18 */
19 19
20 #include "modules/plugins/DOMMimeType.h" 20 #include "modules/plugins/DOMMimeType.h"
21 21
22 #include "core/frame/LocalFrame.h" 22 #include "core/frame/LocalFrame.h"
23 #include "core/loader/FrameLoader.h" 23 #include "core/loader/FrameLoader.h"
24 #include "core/page/Page.h" 24 #include "core/page/Page.h"
25 #include "modules/plugins/DOMPlugin.h" 25 #include "modules/plugins/DOMPlugin.h"
26 #include "platform/wtf/text/StringBuilder.h" 26 #include "platform/wtf/text/StringBuilder.h"
27 27
28 namespace blink { 28 namespace blink {
29 29
30 DOMMimeType::DOMMimeType(PassRefPtr<PluginData> plugin_data, 30 DOMMimeType::DOMMimeType(LocalFrame* frame,
31 LocalFrame* frame, 31 const MimeClassInfo& mime_class_info)
32 unsigned index) 32 : ContextClient(frame), mime_class_info_(&mime_class_info) {}
33 : ContextClient(frame),
34 plugin_data_(std::move(plugin_data)),
35 index_(index) {}
36 33
37 DOMMimeType::~DOMMimeType() {} 34 DOMMimeType::~DOMMimeType() {}
38 35
39 DEFINE_TRACE(DOMMimeType) { 36 DEFINE_TRACE(DOMMimeType) {
40 ContextClient::Trace(visitor); 37 ContextClient::Trace(visitor);
38 visitor->Trace(mime_class_info_);
41 } 39 }
42 40
43 const String& DOMMimeType::type() const { 41 const String& DOMMimeType::type() const {
44 return GetMimeClassInfo().type; 42 return mime_class_info_->Type();
45 } 43 }
46 44
47 String DOMMimeType::suffixes() const { 45 String DOMMimeType::suffixes() const {
48 const Vector<String>& extensions = GetMimeClassInfo().extensions; 46 const Vector<String>& extensions = mime_class_info_->Extensions();
49 47
50 StringBuilder builder; 48 StringBuilder builder;
51 for (size_t i = 0; i < extensions.size(); ++i) { 49 for (size_t i = 0; i < extensions.size(); ++i) {
52 if (i) 50 if (i)
53 builder.Append(','); 51 builder.Append(',');
54 builder.Append(extensions[i]); 52 builder.Append(extensions[i]);
55 } 53 }
56 return builder.ToString(); 54 return builder.ToString();
57 } 55 }
58 56
59 const String& DOMMimeType::description() const { 57 const String& DOMMimeType::description() const {
60 return GetMimeClassInfo().desc; 58 return mime_class_info_->Description();
61 } 59 }
62 60
63 DOMPlugin* DOMMimeType::enabledPlugin() const { 61 DOMPlugin* DOMMimeType::enabledPlugin() const {
64 // FIXME: allowPlugins is just a client call. We should not need 62 // FIXME: allowPlugins is just a client call. We should not need
65 // to bounce through the loader to get there. 63 // to bounce through the loader to get there.
66 // Something like: frame()->page()->client()->allowPlugins(). 64 // Something like: frame()->page()->client()->allowPlugins().
67 if (!GetFrame() || 65 if (!GetFrame() ||
68 !GetFrame()->Loader().AllowPlugins(kNotAboutToInstantiatePlugin)) 66 !GetFrame()->Loader().AllowPlugins(kNotAboutToInstantiatePlugin))
69 return nullptr; 67 return nullptr;
70 68
71 return DOMPlugin::Create(plugin_data_.Get(), GetFrame(), 69 return DOMPlugin::Create(GetFrame(), *mime_class_info_->Plugin());
72 plugin_data_->MimePluginIndices()[index_]);
73 } 70 }
74 71
75 } // namespace blink 72 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698