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

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

Issue 2005433002: [Origin Trials] Install origin trial bindings on V8 context conditionally (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@track-ef-install
Patch Set: Clean up Created 4 years, 6 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) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 } 811 }
812 return v8::Local<v8::Context>(); 812 return v8::Local<v8::Context>();
813 } 813 }
814 814
815 v8::Local<v8::Context> toV8ContextEvenIfDetached(Frame* frame, DOMWrapperWorld& world) 815 v8::Local<v8::Context> toV8ContextEvenIfDetached(Frame* frame, DOMWrapperWorld& world)
816 { 816 {
817 ASSERT(frame); 817 ASSERT(frame);
818 return frame->windowProxy(world)->contextIfInitialized(); 818 return frame->windowProxy(world)->contextIfInitialized();
819 } 819 }
820 820
821 void initializeOriginTrialsCore(v8::Local<v8::Context> context, const DOMWrapper World& world)
haraken 2016/05/27 00:01:42 Who calls this method? I guess initializeOriginTri
iclelland 2016/05/27 03:19:43 Yes, when registerInitializeOriginTrialsForModules
822 {
823 // TODO(iclelland): Generate all of this logic at compile-time, based on the
824 // configuration of origin trial enabled attibutes and interfaces in IDL
825 // files. (crbug.com/615060)
826
827 DCHECK(!context.IsEmpty());
828 // Initialization code for origin trials for core bindings, if necessary,
829 // should go here.
830 }
831
832 namespace {
833 initializeOriginTrialsFunction s_initializeOriginTrialsFunction = &initializeOri ginTrialsCore;
834 }
835
836 void initializeOriginTrials(v8::Local<v8::Context> context, const DOMWrapperWorl d& world)
837 {
838 (*s_initializeOriginTrialsFunction)(context, world);
839 }
840
841 initializeOriginTrialsFunction setInitializeOriginTrialsFunction(initializeOrigi nTrialsFunction newInitializeOriginTrialsFunction)
842 {
843 initializeOriginTrialsFunction originalFunction = s_initializeOriginTrialsFu nction;
844 s_initializeOriginTrialsFunction = newInitializeOriginTrialsFunction;
845 return originalFunction;
846 }
847
821 void crashIfIsolateIsDead(v8::Isolate* isolate) 848 void crashIfIsolateIsDead(v8::Isolate* isolate)
822 { 849 {
823 if (isolate->IsDead()) { 850 if (isolate->IsDead()) {
824 // FIXME: We temporarily deal with V8 internal error situations 851 // FIXME: We temporarily deal with V8 internal error situations
825 // such as out-of-memory by crashing the renderer. 852 // such as out-of-memory by crashing the renderer.
826 CRASH(); 853 CRASH();
827 } 854 }
828 } 855 }
829 856
830 bool isValidEnum(const String& value, const char** validValues, size_t length, c onst String& enumName, ExceptionState& exceptionState) 857 bool isValidEnum(const String& value, const char** validValues, size_t length, c onst String& enumName, ExceptionState& exceptionState)
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data))); 947 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data)));
921 } 948 }
922 949
923 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, v8::Isolate* iso late) 950 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, v8::Isolate* iso late)
924 { 951 {
925 v8CallOrCrash(value.As<v8::Object>()->SetIntegrityLevel(isolate->GetCurrentC ontext(), v8::IntegrityLevel::kFrozen)); 952 v8CallOrCrash(value.As<v8::Object>()->SetIntegrityLevel(isolate->GetCurrentC ontext(), v8::IntegrityLevel::kFrozen));
926 return value; 953 return value;
927 } 954 }
928 955
929 } // namespace blink 956 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698