本文整理汇总了C++中createScriptCallStack函数的典型用法代码示例。如果您正苦于以下问题:C++ createScriptCallStack函数的具体用法?C++ createScriptCallStack怎么用?C++ createScriptCallStack使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createScriptCallStack函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: messageHandlerInMainThread
static void messageHandlerInMainThread(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data)
{
DOMWindow* firstWindow = firstDOMWindow();
if (!firstWindow->isCurrentlyDisplayedInFrame())
return;
String errorMessage = toWebCoreString(message->Get());
v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace();
RefPtr<ScriptCallStack> callStack;
// Currently stack trace is only collected when inspector is open.
if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0)
callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture);
v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsString();
String resource = shouldUseDocumentURL ? firstWindow->document()->url() : toWebCoreString(resourceName);
RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, message->GetLineNumber(), message->GetStartColumn());
// messageHandlerInMainThread can be called while we're creating a new context.
// Since we cannot create a wrapper in the intermediate timing, we need to skip
// creating a wrapper for |event|.
DOMWrapperWorld* world = DOMWrapperWorld::current();
Frame* frame = firstWindow->document()->frame();
if (world && frame && frame->script()->existingWindowShell(world)) {
v8::Local<v8::Value> wrappedEvent = toV8(event.get(), v8::Handle<v8::Object>(), v8::Isolate::GetCurrent());
if (!wrappedEvent.IsEmpty()) {
ASSERT(wrappedEvent->IsObject());
v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenPropertyName::error(), data);
}
}
AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin;
firstWindow->document()->reportException(event.release(), callStack, corsStatus);
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:34,代码来源:V8Initializer.cpp
示例2: ASSERT
void V8ConsoleMessage::handler(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data)
{
// Use the frame where JavaScript is called from.
Frame* frame = V8Proxy::retrieveFrameForEnteredContext();
if (!frame)
return;
Page* page = frame->page();
if (!page)
return;
v8::Handle<v8::String> errorMessageString = message->Get();
ASSERT(!errorMessageString.IsEmpty());
String errorMessage = toWebCoreString(errorMessageString);
v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace();
RefPtr<ScriptCallStack> callStack;
// Currently stack trace is only collected when inspector is open.
if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0)
callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture);
v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
bool useURL = resourceName.IsEmpty() || !resourceName->IsString();
String resourceNameString = useURL ? frame->document()->url() : toWebCoreString(resourceName);
V8ConsoleMessage consoleMessage(errorMessage, resourceNameString, message->GetLineNumber());
consoleMessage.dispatchNow(page, callStack);
}
开发者ID:dslab-epfl,项目名称:warr,代码行数:26,代码来源:V8ConsoleMessage.cpp
示例3: createScriptCallStack
PassRefPtr<Inspector::Protocol::Network::Initiator> InspectorResourceAgent::buildInitiatorObject(Document* document)
{
RefPtr<ScriptCallStack> stackTrace = createScriptCallStack(JSMainThreadExecState::currentState(), ScriptCallStack::maxCallStackSizeToCapture);
if (stackTrace && stackTrace->size() > 0) {
RefPtr<Inspector::Protocol::Network::Initiator> initiatorObject = Inspector::Protocol::Network::Initiator::create()
.setType(Inspector::Protocol::Network::Initiator::Type::Script);
initiatorObject->setStackTrace(stackTrace->buildInspectorArray());
return initiatorObject;
}
if (document && document->scriptableDocumentParser()) {
RefPtr<Inspector::Protocol::Network::Initiator> initiatorObject = Inspector::Protocol::Network::Initiator::create()
.setType(Inspector::Protocol::Network::Initiator::Type::Parser);
initiatorObject->setUrl(document->url().string());
initiatorObject->setLineNumber(document->scriptableDocumentParser()->textPosition().m_line.oneBasedInt());
return initiatorObject;
}
if (m_isRecalculatingStyle && m_styleRecalculationInitiator)
return m_styleRecalculationInitiator;
return Inspector::Protocol::Network::Initiator::create()
.setType(Inspector::Protocol::Network::Initiator::Type::Other)
.release();
}
开发者ID:sinoory,项目名称:webv8,代码行数:25,代码来源:InspectorResourceAgent.cpp
示例4: createScriptCallStack
PassRefPtr<TypeBuilder::Network::Initiator> InspectorResourceAgent::buildInitiatorObject(Document* document)
{
RefPtr<ScriptCallStack> stackTrace = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true);
if (stackTrace && stackTrace->size() > 0) {
RefPtr<TypeBuilder::Network::Initiator> initiatorObject = TypeBuilder::Network::Initiator::create()
.setType(TypeBuilder::Network::Initiator::Type::Script);
initiatorObject->setStackTrace(stackTrace->buildInspectorArray());
return initiatorObject;
}
if (document && document->scriptableDocumentParser()) {
RefPtr<TypeBuilder::Network::Initiator> initiatorObject = TypeBuilder::Network::Initiator::create()
.setType(TypeBuilder::Network::Initiator::Type::Parser);
initiatorObject->setUrl(document->url().string());
initiatorObject->setLineNumber(document->scriptableDocumentParser()->lineNumber().oneBasedInt());
return initiatorObject;
}
if (m_isRecalculatingStyle && m_styleRecalculationInitiator)
return m_styleRecalculationInitiator;
return TypeBuilder::Network::Initiator::create()
.setType(TypeBuilder::Network::Initiator::Type::Other)
.release();
}
开发者ID:Channely,项目名称:know-your-chrome,代码行数:25,代码来源:InspectorResourceAgent.cpp
示例5: messageHandlerInMainThread
static void messageHandlerInMainThread(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data)
{
ASSERT(isMainThread());
// It's possible that messageHandlerInMainThread() is invoked while we're initializing a window.
// In that half-baked situation, we don't have a valid context nor a valid world,
// so just return immediately.
if (DOMWrapperWorld::windowIsBeingInitialized())
return;
v8::Isolate* isolate = v8::Isolate::GetCurrent();
// If called during context initialization, there will be no entered window.
LocalDOMWindow* enteredWindow = enteredDOMWindow(isolate);
if (!enteredWindow)
return;
String errorMessage = toCoreString(message->Get());
v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace();
RefPtr<ScriptCallStack> callStack = nullptr;
int scriptId = message->GetScriptOrigin().ScriptID()->Value();
// Currently stack trace is only collected when inspector is open.
if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) {
callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture, isolate);
bool success = false;
int topScriptId = callStack->at(0).scriptId().toInt(&success);
if (success && topScriptId == scriptId)
scriptId = 0;
} else {
Vector<ScriptCallFrame> callFrames;
callStack = ScriptCallStack::create(callFrames);
}
v8::Handle<v8::Value> resourceName = message->GetScriptOrigin().ResourceName();
bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsString();
String resource = shouldUseDocumentURL ? enteredWindow->document()->url() : toCoreString(resourceName.As<v8::String>());
ScriptState* scriptState = ScriptState::current(isolate);
RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, message->GetLineNumber(), message->GetStartColumn() + 1, &scriptState->world());
if (V8DOMWrapper::isDOMWrapper(data)) {
v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(data);
const WrapperTypeInfo* type = toWrapperTypeInfo(obj);
if (V8DOMException::wrapperTypeInfo.isSubclass(type)) {
DOMException* exception = V8DOMException::toNative(obj);
if (exception && !exception->messageForConsole().isEmpty())
event->setUnsanitizedMessage("Uncaught " + exception->toStringForConsole());
}
}
// This method might be called while we're creating a new context. In this case, we
// avoid storing the exception object, as we can't create a wrapper during context creation.
// FIXME: Can we even get here during initialization now that we bail out when GetEntered returns an empty handle?
LocalFrame* frame = enteredWindow->document()->frame();
if (frame && frame->script().existingWindowProxy(scriptState->world())) {
V8ErrorHandler::storeExceptionOnErrorEventWrapper(event.get(), data, scriptState->context()->Global(), isolate);
}
enteredWindow->document()->reportException(event.release(), scriptId, callStack);
}
开发者ID:esprehn,项目名称:mojo,代码行数:58,代码来源:V8Initializer.cpp
示例6: createScriptCallStack
void Console::reportMessageToClient(MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack)
{
String stackTrace;
if (m_frame->page()->chrome().client().shouldReportDetailedMessageForSource(callStack->at(0).sourceURL())) {
RefPtr<ScriptCallStack> fullStack = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture);
stackTrace = PageConsole::formatStackTraceString(message, fullStack);
}
m_frame->page()->chrome().client().addMessageToConsole(ConsoleAPIMessageSource, level, message, callStack->at(0).lineNumber(), callStack->at(0).sourceURL(), stackTrace);
}
开发者ID:halton,项目名称:blink-crosswalk,代码行数:9,代码来源:Console.cpp
示例7: createScriptCallStack
PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize, bool emptyStackIsAllowed)
{
v8::Isolate* isolate = v8::Isolate::GetCurrent();
if (!isolate->InContext())
return nullptr;
v8::HandleScope handleScope(isolate);
v8::Handle<v8::StackTrace> stackTrace(v8::StackTrace::CurrentStackTrace(isolate, maxStackSize, stackTraceOptions));
return createScriptCallStack(stackTrace, maxStackSize, emptyStackIsAllowed, isolate);
}
开发者ID:davemichael,项目名称:mojo,代码行数:9,代码来源:ScriptCallStackFactory.cpp
示例8: INC_STATS
v8::Handle<v8::Value> V8Console::traceCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Console.traceCallback");
Console* imp = V8Console::toNative(args.Holder());
RefPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture));
RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 0));
imp->trace(scriptArguments.release(), callStack);
return v8Undefined();
}
开发者ID:pial003,项目名称:RespImg-WebCore,代码行数:9,代码来源:V8ConsoleCustom.cpp
示例9: internalAddMessage
static void internalAddMessage(Page* page, MessageType type, MessageLevel level, JSC::ExecState* state, PassRefPtr<ScriptArguments> prpArguments, bool acceptNoArguments = false, bool printTrace = false)
{
RefPtr<ScriptArguments> arguments = prpArguments;
if (!page)
return;
if (!acceptNoArguments && !arguments->argumentCount())
return;
size_t stackSize = printTrace ? ScriptCallStack::maxCallStackSizeToCapture : 1;
RefPtr<ScriptCallStack> callStack(createScriptCallStack(state, stackSize));
const ScriptCallFrame& lastCaller = callStack->at(0);
String message;
bool gotMessage = arguments->getFirstArgumentAsString(message);
InspectorInstrumentation::addMessageToConsole(page, ConsoleAPIMessageSource, type, level, message, state, arguments);
if (page->settings().privateBrowsingEnabled())
return;
if (gotMessage)
page->chrome().client().addMessageToConsole(ConsoleAPIMessageSource, type, level, message, lastCaller.lineNumber(), lastCaller.columnNumber(), lastCaller.sourceURL());
if (!page->settings().logsPageMessagesToSystemConsoleEnabled() && !PageConsole::shouldPrintExceptions())
return;
PageConsole::printSourceURLAndPosition(lastCaller.sourceURL(), lastCaller.lineNumber());
printf(": ");
PageConsole::printMessageSourceAndLevelPrefix(ConsoleAPIMessageSource, level, printTrace);
for (size_t i = 0; i < arguments->argumentCount(); ++i) {
String argAsString = arguments->argumentAt(i).toString(arguments->globalState());
printf(" %s", argAsString.utf8().data());
}
printf("\n");
if (!printTrace)
return;
for (size_t i = 0; i < callStack->size(); ++i) {
const ScriptCallFrame& callFrame = callStack->at(i);
String functionName = String(callFrame.functionName());
if (functionName.isEmpty())
functionName = ASCIILiteral("(unknown)");
printf("%lu: %s (", static_cast<unsigned long>(i), functionName.utf8().data());
PageConsole::printSourceURLAndPosition(callFrame.sourceURL(), callFrame.lineNumber());
printf(")\n");
}
}
开发者ID:CannedFish,项目名称:webkitgtk,代码行数:57,代码来源:Console.cpp
示例10: callStack
JSValue JSConsole::profileEnd(ExecState* exec)
{
RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, 1));
const String& title = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
if (exec->hadException())
return jsUndefined();
impl()->profileEnd(title, exec, callStack);
return jsUndefined();
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:10,代码来源:JSConsoleCustom.cpp
示例11: createScriptCallStackForConsole
PassRefPtr<ScriptCallStack> createScriptCallStackForConsole(JSC::ExecState* exec)
{
size_t maxStackSize = 1;
if (InspectorInstrumentation::hasFrontends()) {
ScriptExecutionContext* scriptExecutionContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
if (InspectorInstrumentation::consoleAgentEnabled(scriptExecutionContext))
maxStackSize = ScriptCallStack::maxCallStackSizeToCapture;
}
return createScriptCallStack(exec, maxStackSize);
}
开发者ID:KnightSwarm,项目名称:WebKitTi,代码行数:10,代码来源:ScriptCallStackFactory.cpp
示例12: m_promise
PromiseTracker::PromiseData::PromiseData(const ScriptObject& promise, const ScriptObject& parentPromise, const ScriptValue& result, V8PromiseCustom::PromiseState state, double timestamp)
: m_promise(promise)
, m_parentPromise(parentPromise)
, m_result(result)
, m_state(state)
, m_timeOnCreate(timestamp)
, m_timeOnSettle(-1)
, m_callStackOnCreate(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true))
{
}
开发者ID:coinpayee,项目名称:blink,代码行数:10,代码来源:PromiseTracker.cpp
示例13: createScriptCallStack
Ref<InspectorObject> TimelineRecordFactory::createGenericRecord(JSC::ExecState* state, double startTime, int maxCallStackDepth) {
Ref<InspectorObject> record = InspectorObject::create();
record->setDouble("startTime", startTime);
if (maxCallStackDepth) {
RefPtr<ScriptCallStack> stackTrace = createScriptCallStack(state, maxCallStackDepth);
if (stackTrace && stackTrace->size())
record->setValue("stackTrace", stackTrace->buildInspectorArray());
}
return WTF::move(record);
}
开发者ID:opreaadrian,项目名称:ios-runtime,代码行数:11,代码来源:TimelineRecordFactory.cpp
示例14: createScriptCallStack
PassRefPtr<InspectorObject> TimelineRecordFactory::createGenericRecord(double startTime, int maxCallStackDepth)
{
RefPtr<InspectorObject> record = InspectorObject::create();
record->setDouble("startTime", startTime);
if (maxCallStackDepth) {
RefPtr<ScriptCallStack> stackTrace = createScriptCallStack(JSMainThreadExecState::currentState(), maxCallStackDepth);
if (stackTrace && stackTrace->size())
record->setValue("stackTrace", stackTrace->buildInspectorArray());
}
return record.release();
}
开发者ID:ddxxyy,项目名称:webkit,代码行数:12,代码来源:TimelineRecordFactory.cpp
示例15: createScriptCallStackForConsole
PassRefPtrWillBeRawPtr<ScriptCallStack> createScriptCallStackForConsole(size_t maxStackSize, bool emptyStackIsAllowed)
{
size_t stackSize = 1;
if (InspectorInstrumentation::hasFrontends()) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
if (!isolate->InContext())
return nullptr;
if (InspectorInstrumentation::consoleAgentEnabled(currentExecutionContext(isolate)))
stackSize = maxStackSize;
}
return createScriptCallStack(stackSize, emptyStackIsAllowed);
}
开发者ID:rzr,项目名称:blink-crosswalk,代码行数:12,代码来源:ScriptCallStackFactory.cpp
示例16: jsConsolePrototypeFunctionGroupCollapsed
EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionGroupCollapsed(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSConsole::s_info))
return throwVMTypeError(exec);
JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue));
Console* imp = static_cast<Console*>(castedThis->impl());
RefPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, 0));
size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;
RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize));
imp->groupCollapsed(scriptArguments, callStack);
return JSValue::encode(jsUndefined());
}
开发者ID:DreamOnTheGo,项目名称:src,代码行数:14,代码来源:JSConsole.cpp
示例17: frame
void FrameConsole::addMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> prpConsoleMessage)
{
RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage;
if (muteCount && consoleMessage->source() != ConsoleAPIMessageSource)
return;
// FIXME: This should not need to reach for the main-frame.
// Inspector code should just take the current frame and know how to walk itself.
ExecutionContext* context = frame().document();
if (!context)
return;
if (!messageStorage())
return;
String messageURL;
unsigned lineNumber = 0;
if (consoleMessage->callStack() && consoleMessage->callStack()->size()) {
lineNumber = consoleMessage->callStack()->at(0).lineNumber();
messageURL = consoleMessage->callStack()->at(0).sourceURL();
} else {
lineNumber = consoleMessage->lineNumber();
messageURL = consoleMessage->url();
}
messageStorage()->reportMessage(m_frame->document(), consoleMessage);
if (consoleMessage->source() == CSSMessageSource || consoleMessage->source() == NetworkMessageSource)
return;
RefPtrWillBeRawPtr<ScriptCallStack> reportedCallStack = nullptr;
if (consoleMessage->source() != ConsoleAPIMessageSource) {
if (consoleMessage->callStack() && frame().chromeClient().shouldReportDetailedMessageForSource(frame(), messageURL))
reportedCallStack = consoleMessage->callStack();
} else {
if (!frame().host() || (consoleMessage->scriptArguments() && !consoleMessage->scriptArguments()->argumentCount()))
return;
if (!allClientReportingMessageTypes().contains(consoleMessage->type()))
return;
if (frame().chromeClient().shouldReportDetailedMessageForSource(frame(), messageURL))
reportedCallStack = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture);
}
String stackTrace;
if (reportedCallStack)
stackTrace = FrameConsole::formatStackTraceString(consoleMessage->message(), reportedCallStack);
frame().chromeClient().addMessageToConsole(m_frame, consoleMessage->source(), consoleMessage->level(), consoleMessage->message(), lineNumber, messageURL, stackTrace);
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:49,代码来源:FrameConsole.cpp
示例18: extractCallStack
static PassRefPtrWillBeRawPtr<ScriptCallStack> extractCallStack(v8::Isolate* isolate, v8::Local<v8::Message> message, int* const scriptId)
{
v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace();
RefPtrWillBeRawPtr<ScriptCallStack> callStack = nullptr;
*scriptId = message->GetScriptOrigin().ScriptID()->Value();
// Currently stack trace is only collected when inspector is open.
if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) {
callStack = createScriptCallStack(isolate, stackTrace, ScriptCallStack::maxCallStackSizeToCapture);
bool success = false;
int topScriptId = callStack->at(0).scriptId().toInt(&success);
if (success && topScriptId == *scriptId)
*scriptId = 0;
}
return callStack.release();
}
开发者ID:techtonik,项目名称:chromium,代码行数:15,代码来源:V8Initializer.cpp
示例19: jsConsolePrototypeFunctionTimeEnd
EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionTimeEnd(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSConsole::s_info))
return throwVMTypeError(exec);
JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue));
Console* imp = static_cast<Console*>(castedThis->impl());
RefPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, 1));
size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;
RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize));
const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
imp->timeEnd(title, scriptArguments, callStack);
return JSValue::encode(jsUndefined());
}
开发者ID:DreamOnTheGo,项目名称:src,代码行数:17,代码来源:JSConsole.cpp
示例20: callStack
void Console::profileEnd(const String& title, ScriptState* state)
{
Page* page = this->page();
if (!page)
return;
if (!InspectorInstrumentation::profilerEnabled(page))
return;
RefPtr<ScriptProfile> profile = ScriptProfiler::stop(state, title);
if (!profile)
return;
m_profiles.append(profile);
RefPtr<ScriptCallStack> callStack(createScriptCallStack(state, 1));
InspectorInstrumentation::addProfile(page, profile, callStack);
}
开发者ID:kcomkar,项目名称:webkit,代码行数:17,代码来源:Console.cpp
注:本文中的createScriptCallStack函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论