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

Side by Side Diff: chrome/renderer/extensions/chrome_v8_context_set.cc

Issue 11571014: Lazy load chrome.* APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android compilation Created 7 years, 9 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "chrome/renderer/extensions/chrome_v8_context_set.h" 5 #include "chrome/renderer/extensions/chrome_v8_context_set.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/tracked_objects.h" 9 #include "base/tracked_objects.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 ChromeV8Context* candidate = *iter; 68 ChromeV8Context* candidate = *iter;
69 if (candidate != context) 69 if (candidate != context)
70 DCHECK(candidate->v8_context() != context->v8_context()); 70 DCHECK(candidate->v8_context() != context->v8_context());
71 } 71 }
72 } 72 }
73 contexts_.insert(context); 73 contexts_.insert(context);
74 } 74 }
75 75
76 void ChromeV8ContextSet::Remove(ChromeV8Context* context) { 76 void ChromeV8ContextSet::Remove(ChromeV8Context* context) {
77 if (contexts_.erase(context)) { 77 if (contexts_.erase(context)) {
78 context->clear_web_frame(); 78 context->Invalidate();
79 MessageLoop::current()->DeleteSoon(FROM_HERE, context); 79 MessageLoop::current()->DeleteSoon(FROM_HERE, context);
80 } 80 }
81 } 81 }
82 82
83 ChromeV8ContextSet::ContextSet ChromeV8ContextSet::GetAll() const { 83 ChromeV8ContextSet::ContextSet ChromeV8ContextSet::GetAll() const {
84 return contexts_; 84 return contexts_;
85 } 85 }
86 86
87 ChromeV8Context* ChromeV8ContextSet::GetCurrent() const { 87 ChromeV8Context* ChromeV8ContextSet::GetCurrent() const {
88 if (!v8::Context::InContext()) 88 if (!v8::Context::InContext())
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 for (ContextSet::iterator it = contexts.begin(); it != contexts.end(); 159 for (ContextSet::iterator it = contexts.begin(); it != contexts.end();
160 ++it) { 160 ++it) {
161 if ((*it)->extension() && (*it)->extension()->id() == extension_id) { 161 if ((*it)->extension() && (*it)->extension()->id() == extension_id) {
162 (*it)->DispatchOnUnloadEvent(); 162 (*it)->DispatchOnUnloadEvent();
163 Remove(*it); 163 Remove(*it);
164 } 164 }
165 } 165 }
166 } 166 }
167 167
168 } // namespace extensions 168 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/chrome_v8_context.cc ('k') | chrome/renderer/extensions/chrome_v8_extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698