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

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

Issue 997003004: [bindings] Migrate V8TestingScope out of V8Binding.h/cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « Source/bindings/core/v8/V8Binding.h ('k') | Source/bindings/core/v8/V8BindingTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 return nullptr; 945 return nullptr;
946 TOSTRING_DEFAULT(V8StringResource<TreatNullAsNullString>, nameString , name, nullptr); 946 TOSTRING_DEFAULT(V8StringResource<TreatNullAsNullString>, nameString , name, nullptr);
947 jsonObject->setValue(nameString, propertyValue); 947 jsonObject->setValue(nameString, propertyValue);
948 } 948 }
949 return jsonObject; 949 return jsonObject;
950 } 950 }
951 ASSERT_NOT_REACHED(); 951 ASSERT_NOT_REACHED();
952 return nullptr; 952 return nullptr;
953 } 953 }
954 954
955 V8TestingScope::V8TestingScope(v8::Isolate* isolate)
956 : m_handleScope(isolate)
957 , m_contextScope(v8::Context::New(isolate))
958 // We reuse the main world since the main world is guaranteed to be register ed to ScriptController.
959 , m_scriptState(ScriptStateForTesting::create(isolate->GetCurrentContext(), &DOMWrapperWorld::mainWorld()))
960 {
961 }
962
963 V8TestingScope::~V8TestingScope()
964 {
965 m_scriptState->disposePerContextData();
966 }
967
968 ScriptState* V8TestingScope::scriptState() const
969 {
970 return m_scriptState.get();
971 }
972
973 v8::Isolate* V8TestingScope::isolate() const
974 {
975 return m_scriptState->isolate();
976 }
977
978 void DevToolsFunctionInfo::ensureInitialized() const 955 void DevToolsFunctionInfo::ensureInitialized() const
979 { 956 {
980 if (m_function.IsEmpty()) 957 if (m_function.IsEmpty())
981 return; 958 return;
982 959
983 v8::Handle<v8::Function> originalFunction = getBoundFunction(m_function); 960 v8::Handle<v8::Function> originalFunction = getBoundFunction(m_function);
984 m_scriptId = originalFunction->ScriptId(); 961 m_scriptId = originalFunction->ScriptId();
985 v8::ScriptOrigin origin = originalFunction->GetScriptOrigin(); 962 v8::ScriptOrigin origin = originalFunction->GetScriptOrigin();
986 if (!origin.ResourceName().IsEmpty()) { 963 if (!origin.ResourceName().IsEmpty()) {
987 V8StringResource<> stringResource(origin.ResourceName()); 964 V8StringResource<> stringResource(origin.ResourceName());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 { 1002 {
1026 v8ConstructorAttributeGetter(info); 1003 v8ConstructorAttributeGetter(info);
1027 } 1004 }
1028 1005
1029 void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::V alue>& info) 1006 void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::V alue>& info)
1030 { 1007 {
1031 v8ConstructorAttributeGetter(info); 1008 v8ConstructorAttributeGetter(info);
1032 } 1009 }
1033 1010
1034 } // namespace blink 1011 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8Binding.h ('k') | Source/bindings/core/v8/V8BindingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698