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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 PluginLib* PluginLib::CreatePluginLib(const base::FilePath& filename) { | 25 PluginLib* PluginLib::CreatePluginLib(const base::FilePath& filename) { |
26 // We can only have one PluginLib object per plugin as it controls the per | 26 // We can only have one PluginLib object per plugin as it controls the per |
27 // instance function calls (i.e. NP_Initialize and NP_Shutdown). So we keep | 27 // instance function calls (i.e. NP_Initialize and NP_Shutdown). So we keep |
28 // a map of PluginLib objects. | 28 // a map of PluginLib objects. |
29 if (!g_loaded_libs) | 29 if (!g_loaded_libs) |
30 g_loaded_libs = new std::vector<scoped_refptr<PluginLib> >; | 30 g_loaded_libs = new std::vector<scoped_refptr<PluginLib> >; |
31 | 31 |
32 for (size_t i = 0; i < g_loaded_libs->size(); ++i) { | 32 for (size_t i = 0; i < g_loaded_libs->size(); ++i) { |
33 if ((*g_loaded_libs)[i]->plugin_info().path == filename) | 33 if ((*g_loaded_libs)[i]->plugin_info().path == filename) |
34 return (*g_loaded_libs)[i]; | 34 return (*g_loaded_libs)[i].get(); |
35 } | 35 } |
36 | 36 |
37 webkit::WebPluginInfo info; | 37 webkit::WebPluginInfo info; |
38 const PluginEntryPoints* entry_points = NULL; | 38 const PluginEntryPoints* entry_points = NULL; |
39 if (!PluginList::Singleton()->ReadPluginInfo(filename, &info, &entry_points)) | 39 if (!PluginList::Singleton()->ReadPluginInfo(filename, &info, &entry_points)) |
40 return NULL; | 40 return NULL; |
41 | 41 |
42 return new PluginLib(info, entry_points); | 42 return new PluginLib(info, entry_points); |
43 } | 43 } |
44 | 44 |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 343 |
344 void PluginLib::Shutdown() { | 344 void PluginLib::Shutdown() { |
345 if (initialized_ && !internal_) { | 345 if (initialized_ && !internal_) { |
346 NP_Shutdown(); | 346 NP_Shutdown(); |
347 initialized_ = false; | 347 initialized_ = false; |
348 } | 348 } |
349 } | 349 } |
350 | 350 |
351 } // namespace npapi | 351 } // namespace npapi |
352 } // namespace webkit | 352 } // namespace webkit |
OLD | NEW |