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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp

Issue 1767883002: DevTools: generate string16-based handlers for v8_inspector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for landing 2 Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 v8::HandleScope handleScope(m_isolate); 65 v8::HandleScope handleScope(m_isolate);
66 v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_deb uggerContext)); 66 v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_deb uggerContext));
67 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame); 67 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame);
68 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get( toV8StringInternalized(m_isolate, name))); 68 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get( toV8StringInternalized(m_isolate, name)));
69 v8::Local<v8::Value> result; 69 v8::Local<v8::Value> result;
70 if (!m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocal(&re sult) || !result->IsInt32()) 70 if (!m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocal(&re sult) || !result->IsInt32())
71 return 0; 71 return 0;
72 return result.As<v8::Int32>()->Value(); 72 return result.As<v8::Int32>()->Value();
73 } 73 }
74 74
75 String JavaScriptCallFrame::callV8FunctionReturnString(const char* name) const 75 String16 JavaScriptCallFrame::callV8FunctionReturnString(const char* name) const
76 { 76 {
77 v8::HandleScope handleScope(m_isolate); 77 v8::HandleScope handleScope(m_isolate);
78 v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_deb uggerContext)); 78 v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_deb uggerContext));
79 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame); 79 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame);
80 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get( toV8StringInternalized(m_isolate, name))); 80 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get( toV8StringInternalized(m_isolate, name)));
81 v8::Local<v8::Value> result; 81 v8::Local<v8::Value> result;
82 if (!m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocal(&re sult)) 82 if (!m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocal(&re sult))
83 return String(); 83 return String16();
84 return toWTFStringWithTypeCheck(result); 84 return toProtocolStringWithTypeCheck(result);
85 } 85 }
86 86
87 int JavaScriptCallFrame::sourceID() const 87 int JavaScriptCallFrame::sourceID() const
88 { 88 {
89 return callV8FunctionReturnInt("sourceID"); 89 return callV8FunctionReturnInt("sourceID");
90 } 90 }
91 91
92 int JavaScriptCallFrame::line() const 92 int JavaScriptCallFrame::line() const
93 { 93 {
94 return callV8FunctionReturnInt("line"); 94 return callV8FunctionReturnInt("line");
95 } 95 }
96 96
97 int JavaScriptCallFrame::column() const 97 int JavaScriptCallFrame::column() const
98 { 98 {
99 return callV8FunctionReturnInt("column"); 99 return callV8FunctionReturnInt("column");
100 } 100 }
101 101
102 String JavaScriptCallFrame::scriptName() const 102 String16 JavaScriptCallFrame::scriptName() const
103 { 103 {
104 return callV8FunctionReturnString("scriptName"); 104 return callV8FunctionReturnString("scriptName");
105 } 105 }
106 106
107 String JavaScriptCallFrame::functionName() const 107 String16 JavaScriptCallFrame::functionName() const
108 { 108 {
109 return callV8FunctionReturnString("functionName"); 109 return callV8FunctionReturnString("functionName");
110 } 110 }
111 111
112 int JavaScriptCallFrame::functionLine() const 112 int JavaScriptCallFrame::functionLine() const
113 { 113 {
114 return callV8FunctionReturnInt("functionLine"); 114 return callV8FunctionReturnInt("functionLine");
115 } 115 }
116 116
117 int JavaScriptCallFrame::functionColumn() const 117 int JavaScriptCallFrame::functionColumn() const
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get( toV8StringInternalized(m_isolate, name))); 162 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get( toV8StringInternalized(m_isolate, name)));
163 v8::Local<v8::Array> locations = v8::Local<v8::Array>::Cast(m_client->callIn ternalFunction(func, callFrame, 0, nullptr).ToLocalChecked()); 163 v8::Local<v8::Array> locations = v8::Local<v8::Array>::Cast(m_client->callIn ternalFunction(func, callFrame, 0, nullptr).ToLocalChecked());
164 return locations->Get(scopeIndex); 164 return locations->Get(scopeIndex);
165 } 165 }
166 166
167 v8::Local<v8::Value> JavaScriptCallFrame::thisObject() const 167 v8::Local<v8::Value> JavaScriptCallFrame::thisObject() const
168 { 168 {
169 return v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInt ernalized(m_isolate, "thisObject")); 169 return v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInt ernalized(m_isolate, "thisObject"));
170 } 170 }
171 171
172 String JavaScriptCallFrame::stepInPositions() const 172 String16 JavaScriptCallFrame::stepInPositions() const
173 { 173 {
174 return callV8FunctionReturnString("stepInPositions"); 174 return callV8FunctionReturnString("stepInPositions");
175 } 175 }
176 176
177 bool JavaScriptCallFrame::isAtReturn() const 177 bool JavaScriptCallFrame::isAtReturn() const
178 { 178 {
179 v8::HandleScope handleScope(m_isolate); 179 v8::HandleScope handleScope(m_isolate);
180 v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_deb uggerContext)); 180 v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_deb uggerContext));
181 v8::Local<v8::Value> result = v8::Local<v8::Object>::New(m_isolate, m_callFr ame)->Get(toV8StringInternalized(m_isolate, "isAtReturn")); 181 v8::Local<v8::Value> result = v8::Local<v8::Object>::New(m_isolate, m_callFr ame)->Get(toV8StringInternalized(m_isolate, "isAtReturn"));
182 if (result.IsEmpty() || !result->IsBoolean()) 182 if (result.IsEmpty() || !result->IsBoolean())
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "line"), v8::Integer: :New(isolate, message->GetLineNumber())); 241 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "line"), v8::Integer: :New(isolate, message->GetLineNumber()));
242 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "column"), v8::Intege r::New(isolate, message->GetStartColumn())); 242 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "column"), v8::Intege r::New(isolate, message->GetStartColumn()));
243 if (!message->GetStackTrace().IsEmpty()) 243 if (!message->GetStackTrace().IsEmpty())
244 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), me ssage->GetStackTrace()->AsArray()); 244 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), me ssage->GetStackTrace()->AsArray());
245 else 245 else
246 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), v8 ::Undefined(isolate)); 246 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), v8 ::Undefined(isolate));
247 return exceptionDetails; 247 return exceptionDetails;
248 } 248 }
249 249
250 } // namespace blink 250 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698