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

Side by Side Diff: src/inspector/V8StackTraceImpl.cpp

Issue 2332163002: [inspector] fixed all shorten-64-to-32 warnings (Closed)
Patch Set: Created 4 years, 3 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 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/inspector/V8StackTraceImpl.h" 5 #include "src/inspector/V8StackTraceImpl.h"
6 6
7 #include "src/inspector/StringUtil.h" 7 #include "src/inspector/StringUtil.h"
8 #include "src/inspector/V8Debugger.h" 8 #include "src/inspector/V8Debugger.h"
9 #include "src/inspector/protocol/Protocol.h" 9 #include "src/inspector/protocol/Protocol.h"
10 10
(...skipping 27 matching lines...) Expand all
38 int sourceColumn = frame->GetColumn(); 38 int sourceColumn = frame->GetColumn();
39 return V8StackTraceImpl::Frame(functionName, scriptId, sourceName, 39 return V8StackTraceImpl::Frame(functionName, scriptId, sourceName,
40 sourceLineNumber, sourceColumn); 40 sourceLineNumber, sourceColumn);
41 } 41 }
42 42
43 void toFramesVector(v8::Local<v8::StackTrace> stackTrace, 43 void toFramesVector(v8::Local<v8::StackTrace> stackTrace,
44 std::vector<V8StackTraceImpl::Frame>& frames, 44 std::vector<V8StackTraceImpl::Frame>& frames,
45 size_t maxStackSize, v8::Isolate* isolate) { 45 size_t maxStackSize, v8::Isolate* isolate) {
46 DCHECK(isolate->InContext()); 46 DCHECK(isolate->InContext());
47 int frameCount = stackTrace->GetFrameCount(); 47 int frameCount = stackTrace->GetFrameCount();
48 if (frameCount > static_cast<int>(maxStackSize)) frameCount = maxStackSize; 48 if (frameCount > static_cast<int>(maxStackSize))
49 frameCount = static_cast<int>(maxStackSize);
49 for (int i = 0; i < frameCount; i++) { 50 for (int i = 0; i < frameCount; i++) {
50 v8::Local<v8::StackFrame> stackFrame = stackTrace->GetFrame(i); 51 v8::Local<v8::StackFrame> stackFrame = stackTrace->GetFrame(i);
51 frames.push_back(toFrame(stackFrame)); 52 frames.push_back(toFrame(stackFrame));
52 } 53 }
53 } 54 }
54 55
55 } // namespace 56 } // namespace
56 57
57 V8StackTraceImpl::Frame::Frame() 58 V8StackTraceImpl::Frame::Frame()
58 : m_functionName("undefined"), 59 : m_functionName("undefined"),
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 153 }
153 154
154 std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::capture( 155 std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::capture(
155 V8Debugger* debugger, int contextGroupId, size_t maxStackSize, 156 V8Debugger* debugger, int contextGroupId, size_t maxStackSize,
156 const String16& description) { 157 const String16& description) {
157 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 158 v8::Isolate* isolate = v8::Isolate::GetCurrent();
158 v8::HandleScope handleScope(isolate); 159 v8::HandleScope handleScope(isolate);
159 v8::Local<v8::StackTrace> stackTrace; 160 v8::Local<v8::StackTrace> stackTrace;
160 if (isolate->InContext()) { 161 if (isolate->InContext()) {
161 isolate->GetCpuProfiler()->CollectSample(); 162 isolate->GetCpuProfiler()->CollectSample();
162 stackTrace = v8::StackTrace::CurrentStackTrace(isolate, maxStackSize, 163 DCHECK(maxStackSize <= std::numeric_limits<int>::max());
163 stackTraceOptions); 164 stackTrace = v8::StackTrace::CurrentStackTrace(
165 isolate, static_cast<int>(maxStackSize), stackTraceOptions);
164 } 166 }
165 return V8StackTraceImpl::create(debugger, contextGroupId, stackTrace, 167 return V8StackTraceImpl::create(debugger, contextGroupId, stackTrace,
166 maxStackSize, description); 168 maxStackSize, description);
167 } 169 }
168 170
169 std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::cloneImpl() { 171 std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::cloneImpl() {
170 std::vector<Frame> framesCopy(m_frames); 172 std::vector<Frame> framesCopy(m_frames);
171 return wrapUnique( 173 return wrapUnique(
172 new V8StackTraceImpl(m_contextGroupId, m_description, framesCopy, 174 new V8StackTraceImpl(m_contextGroupId, m_description, framesCopy,
173 m_parent ? m_parent->cloneImpl() : nullptr)); 175 m_parent ? m_parent->cloneImpl() : nullptr));
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 stackTrace.append(String16::fromInteger(frame.lineNumber())); 266 stackTrace.append(String16::fromInteger(frame.lineNumber()));
265 stackTrace.append(':'); 267 stackTrace.append(':');
266 stackTrace.append(String16::fromInteger(frame.columnNumber())); 268 stackTrace.append(String16::fromInteger(frame.columnNumber()));
267 stackTrace.append(')'); 269 stackTrace.append(')');
268 } 270 }
269 String16 string = stackTrace.toString(); 271 String16 string = stackTrace.toString();
270 return StringBufferImpl::adopt(string); 272 return StringBufferImpl::adopt(string);
271 } 273 }
272 274
273 } // namespace v8_inspector 275 } // namespace v8_inspector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698