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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp

Issue 2640823004: Allow origin trials to be enabled by script (Closed)
Patch Set: Address nit Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 if (constructor.IsEmpty()) 163 if (constructor.IsEmpty())
164 return v8::Local<v8::Object>(); 164 return v8::Local<v8::Object>();
165 v8::Local<v8::Value> prototypeValue; 165 v8::Local<v8::Value> prototypeValue;
166 if (!constructor->Get(context(), v8String(m_isolate, "prototype")) 166 if (!constructor->Get(context(), v8String(m_isolate, "prototype"))
167 .ToLocal(&prototypeValue) || 167 .ToLocal(&prototypeValue) ||
168 !prototypeValue->IsObject()) 168 !prototypeValue->IsObject())
169 return v8::Local<v8::Object>(); 169 return v8::Local<v8::Object>();
170 return prototypeValue.As<v8::Object>(); 170 return prototypeValue.As<v8::Object>();
171 } 171 }
172 172
173 bool V8PerContextData::getExistingConstructorAndPrototypeForType(
174 const WrapperTypeInfo* type,
175 v8::Local<v8::Object>* prototypeObject,
176 v8::Local<v8::Function>* interfaceObject) {
177 *interfaceObject = m_constructorMap.Get(type);
178 if (interfaceObject->IsEmpty()) {
179 *prototypeObject = v8::Local<v8::Object>();
180 return false;
181 }
182 *prototypeObject = prototypeForType(type);
183 DCHECK(!prototypeObject->IsEmpty());
184 return true;
185 }
186
173 void V8PerContextData::addCustomElementBinding( 187 void V8PerContextData::addCustomElementBinding(
174 std::unique_ptr<V0CustomElementBinding> binding) { 188 std::unique_ptr<V0CustomElementBinding> binding) {
175 m_customElementBindings.push_back(std::move(binding)); 189 m_customElementBindings.push_back(std::move(binding));
176 } 190 }
177 191
178 void V8PerContextData::setModulator(Modulator* modulator) { 192 void V8PerContextData::setModulator(Modulator* modulator) {
179 DCHECK(!m_modulator); 193 DCHECK(!m_modulator);
180 DCHECK(modulator); 194 DCHECK(modulator);
181 m_modulator = modulator; 195 m_modulator = modulator;
182 } 196 }
183 197
184 void V8PerContextData::clearModulator() { 198 void V8PerContextData::clearModulator() {
185 m_modulator = nullptr; 199 m_modulator = nullptr;
186 } 200 }
187 201
188 } // namespace blink 202 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698