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

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: more fixes Created 7 years, 10 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 #endif 72 #endif
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->Invalidate();
78 context->clear_web_frame(); 79 context->clear_web_frame();
79 MessageLoop::current()->DeleteSoon(FROM_HERE, context); 80 MessageLoop::current()->DeleteSoon(FROM_HERE, context);
80 } 81 }
81 } 82 }
82 83
83 ChromeV8ContextSet::ContextSet ChromeV8ContextSet::GetAll() const { 84 ChromeV8ContextSet::ContextSet ChromeV8ContextSet::GetAll() const {
84 return contexts_; 85 return contexts_;
85 } 86 }
86 87
87 ChromeV8Context* ChromeV8ContextSet::GetCurrent() const { 88 ChromeV8Context* ChromeV8ContextSet::GetCurrent() const {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 for (ContextSet::iterator it = contexts.begin(); it != contexts.end(); 160 for (ContextSet::iterator it = contexts.begin(); it != contexts.end();
160 ++it) { 161 ++it) {
161 if ((*it)->extension() && (*it)->extension()->id() == extension_id) { 162 if ((*it)->extension() && (*it)->extension()->id() == extension_id) {
162 (*it)->DispatchOnUnloadEvent(); 163 (*it)->DispatchOnUnloadEvent();
163 Remove(*it); 164 Remove(*it);
164 } 165 }
165 } 166 }
166 } 167 }
167 168
168 } // namespace extensions 169 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698