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

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

Issue 195973002: Change DCHECK_IS_ON() to DCHECK_IS_ON (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Keep a comment Created 6 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/message_loop.h" 8 #include "base/message_loop/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 17 matching lines...) Expand all
28 ChromeV8ContextSet::ChromeV8ContextSet() { 28 ChromeV8ContextSet::ChromeV8ContextSet() {
29 } 29 }
30 ChromeV8ContextSet::~ChromeV8ContextSet() { 30 ChromeV8ContextSet::~ChromeV8ContextSet() {
31 } 31 }
32 32
33 int ChromeV8ContextSet::size() const { 33 int ChromeV8ContextSet::size() const {
34 return static_cast<int>(contexts_.size()); 34 return static_cast<int>(contexts_.size());
35 } 35 }
36 36
37 void ChromeV8ContextSet::Add(ChromeV8Context* context) { 37 void ChromeV8ContextSet::Add(ChromeV8Context* context) {
38 if (DCHECK_IS_ON()) { 38 #if DCHECK_IS_ON
39 // It's OK to insert the same context twice, but we should only ever have 39 // It's OK to insert the same context twice, but we should only ever have
40 // one ChromeV8Context per v8::Context. 40 // one ChromeV8Context per v8::Context.
41 for (ContextSet::iterator iter = contexts_.begin(); iter != contexts_.end(); 41 for (ContextSet::iterator iter = contexts_.begin(); iter != contexts_.end();
42 ++iter) { 42 ++iter) {
43 ChromeV8Context* candidate = *iter; 43 ChromeV8Context* candidate = *iter;
44 if (candidate != context) 44 if (candidate != context)
45 DCHECK(candidate->v8_context() != context->v8_context()); 45 DCHECK(candidate->v8_context() != context->v8_context());
46 }
47 } 46 }
47 #endif
48 contexts_.insert(context); 48 contexts_.insert(context);
49 } 49 }
50 50
51 void ChromeV8ContextSet::Remove(ChromeV8Context* context) { 51 void ChromeV8ContextSet::Remove(ChromeV8Context* context) {
52 if (contexts_.erase(context)) { 52 if (contexts_.erase(context)) {
53 context->Invalidate(); 53 context->Invalidate();
54 base::MessageLoop::current()->DeleteSoon(FROM_HERE, context); 54 base::MessageLoop::current()->DeleteSoon(FROM_HERE, context);
55 } 55 }
56 } 56 }
57 57
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 (*it)->DispatchOnUnloadEvent(); 129 (*it)->DispatchOnUnloadEvent();
130 removed.insert(*it); 130 removed.insert(*it);
131 Remove(*it); 131 Remove(*it);
132 } 132 }
133 } 133 }
134 134
135 return removed; 135 return removed;
136 } 136 }
137 137
138 } // namespace extensions 138 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/chrome_v8_context.cc ('k') | chrome/renderer/extensions/logging_native_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698