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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin_registry.cc

Issue 9609008: Implemented Browser Plugin (NOT FOR REVIEW) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updated according to creis@'s comments Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/renderer/browser_plugin/browser_plugin_registry.h"
6
7 #include "base/logging.h"
8
9 namespace content {
10
11 webkit::ppapi::PluginModule* BrowserPluginRegistry::GetModule(
12 int guest_process_id) {
13 return modules_.Lookup(guest_process_id);
14 }
15
16 void BrowserPluginRegistry::AddModule(int guest_process_id,
17 webkit::ppapi::PluginModule* module) {
18 modules_.AddWithID(module, guest_process_id);
19 }
20
21 void BrowserPluginRegistry::PluginModuleDead(
22 webkit::ppapi::PluginModule* dead_module) {
23 // DANGER: Don't dereference the dead_module pointer! It may be in the
24 // process of being deleted.
25
26 // Modules aren't destroyed very often and there are normally at most a
27 // couple of them. So for now we just do a brute-force search.
28 IDMap<webkit::ppapi::PluginModule>::iterator iter(&modules_);
29 while (!iter.IsAtEnd()) {
30 if (iter.GetCurrentValue() == dead_module) {
31 modules_.Remove(iter.GetCurrentKey());
32 return;
33 }
34 iter.Advance();
35 }
36 NOTREACHED(); // Should have always found the module above.
37 }
38
39 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698