OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |