Add new CefV8StackTrace and CefV8StackFrame interfaces to support retrieval of the JavaScript stack trace for the currently active V8 context (issue #682).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@728 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-07-25 11:52:03 +00:00
parent ea6c91fbdb
commit c91f8132d5
8 changed files with 572 additions and 0 deletions

View File

@ -0,0 +1,142 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/v8stack_frame_cpptoc.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
cef_string_userfree_t CEF_CALLBACK v8stack_frame_get_script_name(
struct _cef_v8stack_frame_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefV8StackFrameCppToC::Get(self)->GetScriptName();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK v8stack_frame_get_script_name_or_source_url(
struct _cef_v8stack_frame_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefV8StackFrameCppToC::Get(
self)->GetScriptNameOrSourceURL();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK v8stack_frame_get_function_name(
struct _cef_v8stack_frame_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefV8StackFrameCppToC::Get(self)->GetFunctionName();
// Return type: string
return _retval.DetachToUserFree();
}
int CEF_CALLBACK v8stack_frame_get_line_number(
struct _cef_v8stack_frame_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefV8StackFrameCppToC::Get(self)->GetLineNumber();
// Return type: simple
return _retval;
}
int CEF_CALLBACK v8stack_frame_get_column(struct _cef_v8stack_frame_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefV8StackFrameCppToC::Get(self)->GetColumn();
// Return type: simple
return _retval;
}
int CEF_CALLBACK v8stack_frame_is_eval(struct _cef_v8stack_frame_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefV8StackFrameCppToC::Get(self)->IsEval();
// Return type: bool
return _retval;
}
int CEF_CALLBACK v8stack_frame_is_constructor(
struct _cef_v8stack_frame_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefV8StackFrameCppToC::Get(self)->IsConstructor();
// Return type: bool
return _retval;
}
// CONSTRUCTOR - Do not edit by hand.
CefV8StackFrameCppToC::CefV8StackFrameCppToC(CefV8StackFrame* cls)
: CefCppToC<CefV8StackFrameCppToC, CefV8StackFrame, cef_v8stack_frame_t>(
cls) {
struct_.struct_.get_script_name = v8stack_frame_get_script_name;
struct_.struct_.get_script_name_or_source_url =
v8stack_frame_get_script_name_or_source_url;
struct_.struct_.get_function_name = v8stack_frame_get_function_name;
struct_.struct_.get_line_number = v8stack_frame_get_line_number;
struct_.struct_.get_column = v8stack_frame_get_column;
struct_.struct_.is_eval = v8stack_frame_is_eval;
struct_.struct_.is_constructor = v8stack_frame_is_constructor;
}
#ifndef NDEBUG
template<> long CefCppToC<CefV8StackFrameCppToC, CefV8StackFrame,
cef_v8stack_frame_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,37 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_V8STACK_FRAME_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_V8STACK_FRAME_CPPTOC_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef_v8.h"
#include "include/capi/cef_v8_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefV8StackFrameCppToC
: public CefCppToC<CefV8StackFrameCppToC, CefV8StackFrame,
cef_v8stack_frame_t> {
public:
explicit CefV8StackFrameCppToC(CefV8StackFrame* cls);
virtual ~CefV8StackFrameCppToC() {}
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_V8STACK_FRAME_CPPTOC_H_

View File

@ -0,0 +1,79 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/v8stack_frame_cpptoc.h"
#include "libcef_dll/cpptoc/v8stack_trace_cpptoc.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_v8stack_trace_t* cef_v8stack_trace_get_current(int frame_limit) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefRefPtr<CefV8StackTrace> _retval = CefV8StackTrace::GetCurrent(
frame_limit);
// Return type: refptr_same
return CefV8StackTraceCppToC::Wrap(_retval);
}
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK v8stack_trace_get_frame_count(
struct _cef_v8stack_trace_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefV8StackTraceCppToC::Get(self)->GetFrameCount();
// Return type: simple
return _retval;
}
struct _cef_v8stack_frame_t* CEF_CALLBACK v8stack_trace_get_frame(
struct _cef_v8stack_trace_t* self, int index) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefV8StackFrame> _retval = CefV8StackTraceCppToC::Get(
self)->GetFrame(
index);
// Return type: refptr_same
return CefV8StackFrameCppToC::Wrap(_retval);
}
// CONSTRUCTOR - Do not edit by hand.
CefV8StackTraceCppToC::CefV8StackTraceCppToC(CefV8StackTrace* cls)
: CefCppToC<CefV8StackTraceCppToC, CefV8StackTrace, cef_v8stack_trace_t>(
cls) {
struct_.struct_.get_frame_count = v8stack_trace_get_frame_count;
struct_.struct_.get_frame = v8stack_trace_get_frame;
}
#ifndef NDEBUG
template<> long CefCppToC<CefV8StackTraceCppToC, CefV8StackTrace,
cef_v8stack_trace_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,37 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_V8STACK_TRACE_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_V8STACK_TRACE_CPPTOC_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef_v8.h"
#include "include/capi/cef_v8_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefV8StackTraceCppToC
: public CefCppToC<CefV8StackTraceCppToC, CefV8StackTrace,
cef_v8stack_trace_t> {
public:
explicit CefV8StackTraceCppToC(CefV8StackTrace* cls);
virtual ~CefV8StackTraceCppToC() {}
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_V8STACK_TRACE_CPPTOC_H_

View File

@ -0,0 +1,121 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/v8stack_frame_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
CefString CefV8StackFrameCToCpp::GetScriptName() {
if (CEF_MEMBER_MISSING(struct_, get_script_name))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_script_name(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefV8StackFrameCToCpp::GetScriptNameOrSourceURL() {
if (CEF_MEMBER_MISSING(struct_, get_script_name_or_source_url))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_script_name_or_source_url(
struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefV8StackFrameCToCpp::GetFunctionName() {
if (CEF_MEMBER_MISSING(struct_, get_function_name))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_function_name(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
int CefV8StackFrameCToCpp::GetLineNumber() {
if (CEF_MEMBER_MISSING(struct_, get_line_number))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->get_line_number(struct_);
// Return type: simple
return _retval;
}
int CefV8StackFrameCToCpp::GetColumn() {
if (CEF_MEMBER_MISSING(struct_, get_column))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->get_column(struct_);
// Return type: simple
return _retval;
}
bool CefV8StackFrameCToCpp::IsEval() {
if (CEF_MEMBER_MISSING(struct_, is_eval))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_eval(struct_);
// Return type: bool
return _retval?true:false;
}
bool CefV8StackFrameCToCpp::IsConstructor() {
if (CEF_MEMBER_MISSING(struct_, is_constructor))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_constructor(struct_);
// Return type: bool
return _retval?true:false;
}
#ifndef NDEBUG
template<> long CefCToCpp<CefV8StackFrameCToCpp, CefV8StackFrame,
cef_v8stack_frame_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,48 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_V8STACK_FRAME_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_V8STACK_FRAME_CTOCPP_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_v8.h"
#include "include/capi/cef_v8_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefV8StackFrameCToCpp
: public CefCToCpp<CefV8StackFrameCToCpp, CefV8StackFrame,
cef_v8stack_frame_t> {
public:
explicit CefV8StackFrameCToCpp(cef_v8stack_frame_t* str)
: CefCToCpp<CefV8StackFrameCToCpp, CefV8StackFrame, cef_v8stack_frame_t>(
str) {}
virtual ~CefV8StackFrameCToCpp() {}
// CefV8StackFrame methods
virtual CefString GetScriptName() OVERRIDE;
virtual CefString GetScriptNameOrSourceURL() OVERRIDE;
virtual CefString GetFunctionName() OVERRIDE;
virtual int GetLineNumber() OVERRIDE;
virtual int GetColumn() OVERRIDE;
virtual bool IsEval() OVERRIDE;
virtual bool IsConstructor() OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_V8STACK_FRAME_CTOCPP_H_

View File

@ -0,0 +1,65 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/v8stack_frame_ctocpp.h"
#include "libcef_dll/ctocpp/v8stack_trace_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefV8StackTrace> CefV8StackTrace::GetCurrent(int frame_limit) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_v8stack_trace_t* _retval = cef_v8stack_trace_get_current(
frame_limit);
// Return type: refptr_same
return CefV8StackTraceCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
int CefV8StackTraceCToCpp::GetFrameCount() {
if (CEF_MEMBER_MISSING(struct_, get_frame_count))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->get_frame_count(struct_);
// Return type: simple
return _retval;
}
CefRefPtr<CefV8StackFrame> CefV8StackTraceCToCpp::GetFrame(int index) {
if (CEF_MEMBER_MISSING(struct_, get_frame))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_v8stack_frame_t* _retval = struct_->get_frame(struct_,
index);
// Return type: refptr_same
return CefV8StackFrameCToCpp::Wrap(_retval);
}
#ifndef NDEBUG
template<> long CefCToCpp<CefV8StackTraceCToCpp, CefV8StackTrace,
cef_v8stack_trace_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,43 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_V8STACK_TRACE_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_V8STACK_TRACE_CTOCPP_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_v8.h"
#include "include/capi/cef_v8_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefV8StackTraceCToCpp
: public CefCToCpp<CefV8StackTraceCToCpp, CefV8StackTrace,
cef_v8stack_trace_t> {
public:
explicit CefV8StackTraceCToCpp(cef_v8stack_trace_t* str)
: CefCToCpp<CefV8StackTraceCToCpp, CefV8StackTrace, cef_v8stack_trace_t>(
str) {}
virtual ~CefV8StackTraceCToCpp() {}
// CefV8StackTrace methods
virtual int GetFrameCount() OVERRIDE;
virtual CefRefPtr<CefV8StackFrame> GetFrame(int index) OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_V8STACK_TRACE_CTOCPP_H_