OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/plugins/npapi/plugin_lib.h" | 5 #include "webkit/plugins/npapi/plugin_lib.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/stats_counters.h" | 10 #include "base/metrics/stats_counters.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 PluginLib* PluginLib::CreatePluginLib(const FilePath& filename) { | 26 PluginLib* PluginLib::CreatePluginLib(const FilePath& filename) { |
27 // We can only have one PluginLib object per plugin as it controls the per | 27 // We can only have one PluginLib object per plugin as it controls the per |
28 // instance function calls (i.e. NP_Initialize and NP_Shutdown). So we keep | 28 // instance function calls (i.e. NP_Initialize and NP_Shutdown). So we keep |
29 // a map of PluginLib objects. | 29 // a map of PluginLib objects. |
30 if (!g_loaded_libs) | 30 if (!g_loaded_libs) |
31 g_loaded_libs = new std::vector<scoped_refptr<PluginLib> >; | 31 g_loaded_libs = new std::vector<scoped_refptr<PluginLib> >; |
32 | 32 |
33 for (size_t i = 0; i < g_loaded_libs->size(); ++i) { | 33 for (size_t i = 0; i < g_loaded_libs->size(); ++i) { |
34 if ((*g_loaded_libs)[i]->plugin_info().path == filename) | 34 if ((*g_loaded_libs)[i]->plugin_info().path == filename) |
35 return (*g_loaded_libs)[i]; | 35 return (*g_loaded_libs)[i].get(); |
36 } | 36 } |
37 | 37 |
38 webkit::WebPluginInfo info; | 38 webkit::WebPluginInfo info; |
39 const PluginEntryPoints* entry_points = NULL; | 39 const PluginEntryPoints* entry_points = NULL; |
40 if (!PluginList::Singleton()->ReadPluginInfo(filename, &info, &entry_points)) | 40 if (!PluginList::Singleton()->ReadPluginInfo(filename, &info, &entry_points)) |
41 return NULL; | 41 return NULL; |
42 | 42 |
43 return new PluginLib(info, entry_points); | 43 return new PluginLib(info, entry_points); |
44 } | 44 } |
45 | 45 |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 344 |
345 void PluginLib::Shutdown() { | 345 void PluginLib::Shutdown() { |
346 if (initialized_ && !internal_) { | 346 if (initialized_ && !internal_) { |
347 NP_Shutdown(); | 347 NP_Shutdown(); |
348 initialized_ = false; | 348 initialized_ = false; |
349 } | 349 } |
350 } | 350 } |
351 | 351 |
352 } // namespace npapi | 352 } // namespace npapi |
353 } // namespace webkit | 353 } // namespace webkit |
OLD | NEW |