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

Side by Side Diff: content/child/npapi/plugin_lib.cc

Issue 22070002: Avoid wasted work in FreePluginLibraryHelper(). (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 4 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
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/child/npapi/plugin_lib.h" 5 #include "content/child/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/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/stats_counters.h" 10 #include "base/metrics/stats_counters.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // plugin dll. 256 // plugin dll.
257 void FreePluginLibraryHelper(const base::FilePath& path, 257 void FreePluginLibraryHelper(const base::FilePath& path,
258 base::NativeLibrary library, 258 base::NativeLibrary library,
259 NP_ShutdownFunc shutdown_func) { 259 NP_ShutdownFunc shutdown_func) {
260 if (shutdown_func) { 260 if (shutdown_func) {
261 // Don't call NP_Shutdown if the library has been reloaded since this task 261 // Don't call NP_Shutdown if the library has been reloaded since this task
262 // was posted. 262 // was posted.
263 bool reloaded = false; 263 bool reloaded = false;
264 if (g_loaded_libs) { 264 if (g_loaded_libs) {
265 for (size_t i = 0; i < g_loaded_libs->size(); ++i) { 265 for (size_t i = 0; i < g_loaded_libs->size(); ++i) {
266 if ((*g_loaded_libs)[i]->plugin_info().path == path) 266 if ((*g_loaded_libs)[i]->plugin_info().path == path) {
267 reloaded = true; 267 reloaded = true;
268 break;
269 }
268 } 270 }
269 } 271 }
270 if (!reloaded) 272 if (!reloaded)
271 shutdown_func(); 273 shutdown_func();
272 } 274 }
273 275
274 if (library) { 276 if (library) {
275 // Always call base::UnloadNativeLibrary so that the system reference 277 // Always call base::UnloadNativeLibrary so that the system reference
276 // count is decremented. 278 // count is decremented.
277 base::UnloadNativeLibrary(library); 279 base::UnloadNativeLibrary(library);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 } 328 }
327 329
328 void PluginLib::Shutdown() { 330 void PluginLib::Shutdown() {
329 if (initialized_) { 331 if (initialized_) {
330 NP_Shutdown(); 332 NP_Shutdown();
331 initialized_ = false; 333 initialized_ = false;
332 } 334 }
333 } 335 }
334 336
335 } // namespace content 337 } // namespace content
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698