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

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

Issue 2159633002: [DevTools] Generate public versions of protocol classes to be exposed in v8_inspector/public. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed extra files Created 4 years, 4 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-2011 Google Inc. All rights reserved. 2 * Copyright (c) 2010-2011 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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 V8ConsoleMessageStorage* V8DebuggerImpl::ensureConsoleMessageStorage(int context GroupId) 852 V8ConsoleMessageStorage* V8DebuggerImpl::ensureConsoleMessageStorage(int context GroupId)
853 { 853 {
854 ConsoleStorageMap::iterator storageIt = m_consoleStorageMap.find(contextGrou pId); 854 ConsoleStorageMap::iterator storageIt = m_consoleStorageMap.find(contextGrou pId);
855 if (storageIt == m_consoleStorageMap.end()) 855 if (storageIt == m_consoleStorageMap.end())
856 storageIt = m_consoleStorageMap.insert(std::make_pair(contextGroupId, wr apUnique(new V8ConsoleMessageStorage(this, contextGroupId)))).first; 856 storageIt = m_consoleStorageMap.insert(std::make_pair(contextGroupId, wr apUnique(new V8ConsoleMessageStorage(this, contextGroupId)))).first;
857 return storageIt->second.get(); 857 return storageIt->second.get();
858 } 858 }
859 859
860 std::unique_ptr<V8StackTrace> V8DebuggerImpl::createStackTrace(v8::Local<v8::Sta ckTrace> stackTrace) 860 std::unique_ptr<V8StackTrace> V8DebuggerImpl::createStackTrace(v8::Local<v8::Sta ckTrace> stackTrace)
861 { 861 {
862 return createStackTraceImpl(stackTrace);
863 }
864
865 std::unique_ptr<V8StackTraceImpl> V8DebuggerImpl::createStackTraceImpl(v8::Local <v8::StackTrace> stackTrace)
866 {
862 int contextGroupId = m_isolate->InContext() ? getGroupId(m_isolate->GetCurre ntContext()) : 0; 867 int contextGroupId = m_isolate->InContext() ? getGroupId(m_isolate->GetCurre ntContext()) : 0;
863 return V8StackTraceImpl::create(this, contextGroupId, stackTrace, V8StackTra ceImpl::maxCallStackSizeToCapture); 868 return V8StackTraceImpl::create(this, contextGroupId, stackTrace, V8StackTra ceImpl::maxCallStackSizeToCapture);
864 } 869 }
865 870
866 std::unique_ptr<V8InspectorSession> V8DebuggerImpl::connect(int contextGroupId, protocol::FrontendChannel* channel, V8InspectorSessionClient* client, const Stri ng16* state) 871 std::unique_ptr<V8InspectorSession> V8DebuggerImpl::connect(int contextGroupId, protocol::FrontendChannel* channel, V8InspectorSessionClient* client, const Stri ng16* state)
867 { 872 {
868 DCHECK(m_sessions.find(contextGroupId) == m_sessions.cend()); 873 DCHECK(m_sessions.find(contextGroupId) == m_sessions.cend());
869 std::unique_ptr<V8InspectorSessionImpl> session = 874 std::unique_ptr<V8InspectorSessionImpl> session =
870 V8InspectorSessionImpl::create(this, contextGroupId, channel, client, st ate); 875 V8InspectorSessionImpl::create(this, contextGroupId, channel, client, st ate);
871 m_sessions[contextGroupId] = session.get(); 876 m_sessions[contextGroupId] = session.get();
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 { 1067 {
1063 int contextGroupId = getGroupId(context); 1068 int contextGroupId = getGroupId(context);
1064 InspectedContext* inspectedContext = getContext(contextGroupId, contextId(co ntext)); 1069 InspectedContext* inspectedContext = getContext(contextGroupId, contextId(co ntext));
1065 if (!inspectedContext) 1070 if (!inspectedContext)
1066 return; 1071 return;
1067 std::vector<v8::Local<v8::Value>> arguments; 1072 std::vector<v8::Local<v8::Value>> arguments;
1068 if (!arg1.IsEmpty()) 1073 if (!arg1.IsEmpty())
1069 arguments.push_back(arg1); 1074 arguments.push_back(arg1);
1070 if (!arg2.IsEmpty()) 1075 if (!arg2.IsEmpty())
1071 arguments.push_back(arg2); 1076 arguments.push_back(arg2);
1072 ensureConsoleMessageStorage(contextGroupId)->addMessage(V8ConsoleMessage::cr eateForConsoleAPI(m_client->currentTimeMS(), ConsoleAPIType::kLog, arguments, ca ptureStackTrace(false), inspectedContext)); 1077 ensureConsoleMessageStorage(contextGroupId)->addMessage(V8ConsoleMessage::cr eateForConsoleAPI(m_client->currentTimeMS(), ConsoleAPIType::kLog, arguments, ca ptureStackTraceImpl(false), inspectedContext));
1073 } 1078 }
1074 1079
1075 void V8DebuggerImpl::exceptionThrown(int contextGroupId, const String16& errorMe ssage, const String16& url, unsigned lineNumber, unsigned columnNumber, std::uni que_ptr<V8StackTrace> stackTrace, int scriptId) 1080 void V8DebuggerImpl::exceptionThrown(int contextGroupId, const String16& errorMe ssage, const String16& url, unsigned lineNumber, unsigned columnNumber, std::uni que_ptr<V8StackTrace> stackTrace, int scriptId)
1076 { 1081 {
1082 std::unique_ptr<V8StackTraceImpl> stackTraceImpl = wrapUnique(static_cast<V8 StackTraceImpl*>(stackTrace.release()));
1077 unsigned exceptionId = ++m_lastExceptionId; 1083 unsigned exceptionId = ++m_lastExceptionId;
1078 std::unique_ptr<V8ConsoleMessage> consoleMessage = V8ConsoleMessage::createF orException(m_client->currentTimeMS(), errorMessage, url, lineNumber, columnNumb er, std::move(stackTrace), scriptId, m_isolate, 0, v8::Local<v8::Value>(), excep tionId); 1084 std::unique_ptr<V8ConsoleMessage> consoleMessage = V8ConsoleMessage::createF orException(m_client->currentTimeMS(), errorMessage, url, lineNumber, columnNumb er, std::move(stackTraceImpl), scriptId, m_isolate, 0, v8::Local<v8::Value>(), e xceptionId);
1079 ensureConsoleMessageStorage(contextGroupId)->addMessage(std::move(consoleMes sage)); 1085 ensureConsoleMessageStorage(contextGroupId)->addMessage(std::move(consoleMes sage));
1080 } 1086 }
1081 1087
1082 unsigned V8DebuggerImpl::promiseRejected(v8::Local<v8::Context> context, const S tring16& errorMessage, v8::Local<v8::Value> exception, const String16& url, unsi gned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace> stackTrace , int scriptId) 1088 unsigned V8DebuggerImpl::promiseRejected(v8::Local<v8::Context> context, const S tring16& errorMessage, v8::Local<v8::Value> exception, const String16& url, unsi gned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace> stackTrace , int scriptId)
1083 { 1089 {
1084 int contextGroupId = getGroupId(context); 1090 int contextGroupId = getGroupId(context);
1085 if (!contextGroupId) 1091 if (!contextGroupId)
1086 return 0; 1092 return 0;
1093 std::unique_ptr<V8StackTraceImpl> stackTraceImpl = wrapUnique(static_cast<V8 StackTraceImpl*>(stackTrace.release()));
1087 unsigned exceptionId = ++m_lastExceptionId; 1094 unsigned exceptionId = ++m_lastExceptionId;
1088 std::unique_ptr<V8ConsoleMessage> consoleMessage = V8ConsoleMessage::createF orException(m_client->currentTimeMS(), errorMessage, url, lineNumber, columnNumb er, std::move(stackTrace), scriptId, m_isolate, contextId(context), exception, e xceptionId); 1095 std::unique_ptr<V8ConsoleMessage> consoleMessage = V8ConsoleMessage::createF orException(m_client->currentTimeMS(), errorMessage, url, lineNumber, columnNumb er, std::move(stackTraceImpl), scriptId, m_isolate, contextId(context), exceptio n, exceptionId);
1089 ensureConsoleMessageStorage(contextGroupId)->addMessage(std::move(consoleMes sage)); 1096 ensureConsoleMessageStorage(contextGroupId)->addMessage(std::move(consoleMes sage));
1090 return exceptionId; 1097 return exceptionId;
1091 } 1098 }
1092 1099
1093 void V8DebuggerImpl::promiseRejectionRevoked(v8::Local<v8::Context> context, uns igned promiseRejectionId) 1100 void V8DebuggerImpl::promiseRejectionRevoked(v8::Local<v8::Context> context, uns igned promiseRejectionId)
1094 { 1101 {
1095 int contextGroupId = getGroupId(context); 1102 int contextGroupId = getGroupId(context);
1096 if (!contextGroupId) 1103 if (!contextGroupId)
1097 return; 1104 return;
1098 1105
1099 std::unique_ptr<V8ConsoleMessage> consoleMessage = V8ConsoleMessage::createF orRevokedException(m_client->currentTimeMS(), "Handler added to rejected promise ", promiseRejectionId); 1106 std::unique_ptr<V8ConsoleMessage> consoleMessage = V8ConsoleMessage::createF orRevokedException(m_client->currentTimeMS(), "Handler added to rejected promise ", promiseRejectionId);
1100 ensureConsoleMessageStorage(contextGroupId)->addMessage(std::move(consoleMes sage)); 1107 ensureConsoleMessageStorage(contextGroupId)->addMessage(std::move(consoleMes sage));
1101 } 1108 }
1102 1109
1103 std::unique_ptr<V8StackTrace> V8DebuggerImpl::captureStackTrace(bool fullStack) 1110 std::unique_ptr<V8StackTrace> V8DebuggerImpl::captureStackTrace(bool fullStack)
1104 { 1111 {
1112 return captureStackTraceImpl(fullStack);
1113 }
1114
1115 std::unique_ptr<V8StackTraceImpl> V8DebuggerImpl::captureStackTraceImpl(bool ful lStack)
1116 {
1105 if (!m_isolate->InContext()) 1117 if (!m_isolate->InContext())
1106 return nullptr; 1118 return nullptr;
1107 1119
1108 v8::HandleScope handles(m_isolate); 1120 v8::HandleScope handles(m_isolate);
1109 int contextGroupId = getGroupId(m_isolate->GetCurrentContext()); 1121 int contextGroupId = getGroupId(m_isolate->GetCurrentContext());
1110 if (!contextGroupId) 1122 if (!contextGroupId)
1111 return nullptr; 1123 return nullptr;
1112 1124
1113 size_t stackSize = fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; 1125 size_t stackSize = fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1;
1114 SessionMap::iterator sessionIt = m_sessions.find(contextGroupId); 1126 SessionMap::iterator sessionIt = m_sessions.find(contextGroupId);
(...skipping 27 matching lines...) Expand all
1142 1154
1143 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI d) 1155 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI d)
1144 { 1156 {
1145 if (!contextGroupId) 1157 if (!contextGroupId)
1146 return nullptr; 1158 return nullptr;
1147 SessionMap::iterator iter = m_sessions.find(contextGroupId); 1159 SessionMap::iterator iter = m_sessions.find(contextGroupId);
1148 return iter == m_sessions.end() ? nullptr : iter->second; 1160 return iter == m_sessions.end() ? nullptr : iter->second;
1149 } 1161 }
1150 1162
1151 } // namespace blink 1163 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698