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

Side by Side Diff: extensions/renderer/script_context_set.cc

Issue 842523002: base: Change DCHECK_IS_ON to a macro DCHECK_IS_ON(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dcheck2: withoutandroidchange Created 5 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/renderer/script_context_set.h" 5 #include "extensions/renderer/script_context_set.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "content/public/renderer/render_view.h" 8 #include "content/public/renderer/render_view.h"
9 #include "extensions/common/extension.h" 9 #include "extensions/common/extension.h"
10 #include "extensions/renderer/script_context.h" 10 #include "extensions/renderer/script_context.h"
11 #include "v8/include/v8.h" 11 #include "v8/include/v8.h"
12 12
13 namespace extensions { 13 namespace extensions {
14 14
15 ScriptContextSet::ScriptContextSet() { 15 ScriptContextSet::ScriptContextSet() {
16 } 16 }
17 ScriptContextSet::~ScriptContextSet() { 17 ScriptContextSet::~ScriptContextSet() {
18 } 18 }
19 19
20 int ScriptContextSet::size() const { 20 int ScriptContextSet::size() const {
21 return static_cast<int>(contexts_.size()); 21 return static_cast<int>(contexts_.size());
22 } 22 }
23 23
24 void ScriptContextSet::Add(ScriptContext* context) { 24 void ScriptContextSet::Add(ScriptContext* context) {
25 #if DCHECK_IS_ON 25 #if DCHECK_IS_ON()
26 // It's OK to insert the same context twice, but we should only ever have 26 // It's OK to insert the same context twice, but we should only ever have
27 // one ScriptContext per v8::Context. 27 // one ScriptContext per v8::Context.
28 for (ContextSet::iterator iter = contexts_.begin(); iter != contexts_.end(); 28 for (ContextSet::iterator iter = contexts_.begin(); iter != contexts_.end();
29 ++iter) { 29 ++iter) {
30 ScriptContext* candidate = *iter; 30 ScriptContext* candidate = *iter;
31 if (candidate != context) 31 if (candidate != context)
32 DCHECK(candidate->v8_context() != context->v8_context()); 32 DCHECK(candidate->v8_context() != context->v8_context());
33 } 33 }
34 #endif 34 #endif
35 contexts_.insert(context); 35 contexts_.insert(context);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 (*it)->DispatchOnUnloadEvent(); 115 (*it)->DispatchOnUnloadEvent();
116 removed.insert(*it); 116 removed.insert(*it);
117 Remove(*it); 117 Remove(*it);
118 } 118 }
119 } 119 }
120 120
121 return removed; 121 return removed;
122 } 122 }
123 123
124 } // namespace extensions 124 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698