OLD | NEW |
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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 return nullptr; | 738 return nullptr; |
739 TOSTRING_DEFAULT(V8StringResource<WithNullCheck>, nameString, name,
nullptr); | 739 TOSTRING_DEFAULT(V8StringResource<WithNullCheck>, nameString, name,
nullptr); |
740 jsonObject->setValue(nameString, propertyValue); | 740 jsonObject->setValue(nameString, propertyValue); |
741 } | 741 } |
742 return jsonObject; | 742 return jsonObject; |
743 } | 743 } |
744 ASSERT_NOT_REACHED(); | 744 ASSERT_NOT_REACHED(); |
745 return nullptr; | 745 return nullptr; |
746 } | 746 } |
747 | 747 |
748 PassOwnPtr<V8ExecutionScope> V8ExecutionScope::create(v8::Isolate* isolate) | 748 PassOwnPtr<V8TestingScope> V8TestingScope::create(v8::Isolate* isolate) |
749 { | 749 { |
750 return adoptPtr(new V8ExecutionScope(isolate)); | 750 return adoptPtr(new V8TestingScope(isolate)); |
751 } | 751 } |
752 | 752 |
753 V8ExecutionScope::V8ExecutionScope(v8::Isolate* isolate) | 753 V8TestingScope::V8TestingScope(v8::Isolate* isolate) |
754 : m_handleScope(isolate) | 754 : m_handleScope(isolate) |
755 , m_contextScope(v8::Context::New(isolate)) | 755 , m_contextScope(v8::Context::New(isolate)) |
756 , m_scriptState(ScriptState::create(isolate->GetCurrentContext(), DOMWrapper
World::create())) | 756 , m_scriptState(ScriptStateForTesting::create(isolate->GetCurrentContext(),
DOMWrapperWorld::create())) |
757 { | 757 { |
758 } | 758 } |
759 | 759 |
760 V8ExecutionScope::~V8ExecutionScope() | 760 V8TestingScope::~V8TestingScope() |
761 { | 761 { |
762 m_scriptState->disposePerContextData(); | 762 m_scriptState->disposePerContextData(); |
763 } | 763 } |
764 | 764 |
| 765 ScriptState* V8TestingScope::scriptState() const |
| 766 { |
| 767 return m_scriptState.get(); |
| 768 } |
| 769 |
| 770 v8::Isolate* V8TestingScope::isolate() const |
| 771 { |
| 772 return m_scriptState->isolate(); |
| 773 } |
| 774 |
765 void GetDevToolsFunctionInfo(v8::Handle<v8::Function> function, v8::Isolate* iso
late, int& scriptId, String& resourceName, int& lineNumber) | 775 void GetDevToolsFunctionInfo(v8::Handle<v8::Function> function, v8::Isolate* iso
late, int& scriptId, String& resourceName, int& lineNumber) |
766 { | 776 { |
767 v8::Handle<v8::Function> originalFunction = getBoundFunction(function); | 777 v8::Handle<v8::Function> originalFunction = getBoundFunction(function); |
768 scriptId = originalFunction->ScriptId(); | 778 scriptId = originalFunction->ScriptId(); |
769 v8::ScriptOrigin origin = originalFunction->GetScriptOrigin(); | 779 v8::ScriptOrigin origin = originalFunction->GetScriptOrigin(); |
770 if (!origin.ResourceName().IsEmpty()) { | 780 if (!origin.ResourceName().IsEmpty()) { |
771 resourceName = NativeValueTraits<String>::nativeValue(origin.ResourceNam
e(), isolate); | 781 resourceName = NativeValueTraits<String>::nativeValue(origin.ResourceNam
e(), isolate); |
772 lineNumber = originalFunction->GetScriptLineNumber() + 1; | 782 lineNumber = originalFunction->GetScriptLineNumber() + 1; |
773 } | 783 } |
774 if (resourceName.isEmpty()) { | 784 if (resourceName.isEmpty()) { |
775 resourceName = "undefined"; | 785 resourceName = "undefined"; |
776 lineNumber = 1; | 786 lineNumber = 1; |
777 } | 787 } |
778 } | 788 } |
779 | 789 |
780 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio
nContext* context, v8::Handle<v8::Function> function, v8::Isolate* isolate) | 790 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio
nContext* context, v8::Handle<v8::Function> function, v8::Isolate* isolate) |
781 { | 791 { |
782 int scriptId = 0; | 792 int scriptId = 0; |
783 String resourceName; | 793 String resourceName; |
784 int lineNumber = 1; | 794 int lineNumber = 1; |
785 GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineNumbe
r); | 795 GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineNumbe
r); |
786 return InspectorFunctionCallEvent::data(context, scriptId, resourceName, lin
eNumber); | 796 return InspectorFunctionCallEvent::data(context, scriptId, resourceName, lin
eNumber); |
787 } | 797 } |
788 | 798 |
789 ScriptState* V8ExecutionScope::scriptState() const | |
790 { | |
791 return m_scriptState.get(); | |
792 } | |
793 | |
794 v8::Isolate* V8ExecutionScope::isolate() const | |
795 { | |
796 return m_scriptState->isolate(); | |
797 } | |
798 | |
799 } // namespace WebCore | 799 } // namespace WebCore |
OLD | NEW |