mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Merge revision 644 and 725 changes:
- Add new CefV8StackTrace and CefV8StackFrame interfaces to support retrieval of the JavaScript stack trace for the currently active V8 context (issue #682). - Add CefV8Context::Eval method for synchronous JavaScript execution that returns a value or exception (issue #444). - Refactor V8 unit tests (issue #480). git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/963@726 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
4
cef.gyp
4
cef.gyp
@@ -521,6 +521,10 @@
|
|||||||
'libcef_dll/cpptoc/v8context_cpptoc.h',
|
'libcef_dll/cpptoc/v8context_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/v8exception_cpptoc.cc',
|
'libcef_dll/cpptoc/v8exception_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/v8exception_cpptoc.h',
|
'libcef_dll/cpptoc/v8exception_cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/v8stack_frame_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/v8stack_frame_cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/v8stack_trace_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/v8stack_trace_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/v8value_cpptoc.cc',
|
'libcef_dll/cpptoc/v8value_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/v8value_cpptoc.h',
|
'libcef_dll/cpptoc/v8value_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/web_plugin_info_cpptoc.cc',
|
'libcef_dll/cpptoc/web_plugin_info_cpptoc.cc',
|
||||||
|
@@ -238,6 +238,10 @@
|
|||||||
'libcef_dll/ctocpp/v8context_ctocpp.h',
|
'libcef_dll/ctocpp/v8context_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/v8exception_ctocpp.cc',
|
'libcef_dll/ctocpp/v8exception_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/v8exception_ctocpp.h',
|
'libcef_dll/ctocpp/v8exception_ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/v8stack_frame_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/v8stack_frame_ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/v8stack_trace_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/v8stack_trace_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/v8value_ctocpp.cc',
|
'libcef_dll/ctocpp/v8value_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/v8value_ctocpp.h',
|
'libcef_dll/ctocpp/v8value_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/web_plugin_info_ctocpp.cc',
|
'libcef_dll/ctocpp/web_plugin_info_ctocpp.cc',
|
||||||
|
@@ -79,7 +79,9 @@ class CefStreamReader;
|
|||||||
class CefStreamWriter;
|
class CefStreamWriter;
|
||||||
class CefTask;
|
class CefTask;
|
||||||
class CefV8Context;
|
class CefV8Context;
|
||||||
|
class CefV8Exception;
|
||||||
class CefV8Handler;
|
class CefV8Handler;
|
||||||
|
class CefV8StackFrame;
|
||||||
class CefV8Value;
|
class CefV8Value;
|
||||||
class CefWebPluginInfo;
|
class CefWebPluginInfo;
|
||||||
class CefWebURLRequest;
|
class CefWebURLRequest;
|
||||||
@@ -2545,6 +2547,17 @@ public:
|
|||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual bool IsSame(CefRefPtr<CefV8Context> that) =0;
|
virtual bool IsSame(CefRefPtr<CefV8Context> that) =0;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Evaluates the specified JavaScript code using this context's global object.
|
||||||
|
// On success |retval| will be set to the return value, if any, and the
|
||||||
|
// function will return true. On failure |exception| will be set to the
|
||||||
|
// exception, if any, and the function will return false.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual bool Eval(const CefString& code,
|
||||||
|
CefRefPtr<CefV8Value>& retval,
|
||||||
|
CefRefPtr<CefV8Exception>& exception) =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -2973,6 +2986,89 @@ public:
|
|||||||
bool rethrow_exception) =0;
|
bool rethrow_exception) =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///
|
||||||
|
// Class representing a V8 stack trace. The methods of this class may only be
|
||||||
|
// called on the UI thread.
|
||||||
|
///
|
||||||
|
/*--cef(source=library)--*/
|
||||||
|
class CefV8StackTrace : public virtual CefBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
// Returns the stack trace for the currently active context. |frame_limit| is
|
||||||
|
// the maximum number of frames that will be captured.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
static CefRefPtr<CefV8StackTrace> GetCurrent(int frame_limit);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns the number of stack frames.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual int GetFrameCount() =0;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns the stack frame at the specified 0-based index.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual CefRefPtr<CefV8StackFrame> GetFrame(int index) =0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
// Class representing a V8 stack frame. The methods of this class may only be
|
||||||
|
// called on the UI thread.
|
||||||
|
///
|
||||||
|
/*--cef(source=library)--*/
|
||||||
|
class CefV8StackFrame : public virtual CefBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
// Returns the name of the resource script that contains the function.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual CefString GetScriptName() =0;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns the name of the resource script that contains the function or the
|
||||||
|
// sourceURL value if the script name is undefined and its source ends with
|
||||||
|
// a "//@ sourceURL=..." string.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual CefString GetScriptNameOrSourceURL() =0;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns the name of the function.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual CefString GetFunctionName() =0;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns the 1-based line number for the function call or 0 if unknown.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual int GetLineNumber() =0;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns the 1-based column offset on the line for the function call or 0 if
|
||||||
|
// unknown.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual int GetColumn() =0;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns true if the function was compiled using eval().
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual bool IsEval() =0;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns true if the function was called as a constructor via "new".
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual bool IsConstructor() =0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Class that creates CefSchemeHandler instances. The methods of this class will
|
// Class that creates CefSchemeHandler instances. The methods of this class will
|
||||||
|
@@ -2303,6 +2303,16 @@ typedef struct _cef_v8context_t
|
|||||||
int (CEF_CALLBACK *is_same)(struct _cef_v8context_t* self,
|
int (CEF_CALLBACK *is_same)(struct _cef_v8context_t* self,
|
||||||
struct _cef_v8context_t* that);
|
struct _cef_v8context_t* that);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Evaluates the specified JavaScript code using this context's global object.
|
||||||
|
// On success |retval| will be set to the return value, if any, and the
|
||||||
|
// function will return true (1). On failure |exception| will be set to the
|
||||||
|
// exception, if any, and the function will return false (0).
|
||||||
|
///
|
||||||
|
int (CEF_CALLBACK *eval)(struct _cef_v8context_t* self,
|
||||||
|
const cef_string_t* code, struct _cef_v8value_t** retval,
|
||||||
|
struct _cef_v8exception_t** exception);
|
||||||
|
|
||||||
} cef_v8context_t;
|
} cef_v8context_t;
|
||||||
|
|
||||||
|
|
||||||
@@ -2747,6 +2757,92 @@ CEF_EXPORT cef_v8value_t* cef_v8value_create_function(const cef_string_t* name,
|
|||||||
cef_v8handler_t* handler);
|
cef_v8handler_t* handler);
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
// Structure representing a V8 stack trace. The functions of this structure may
|
||||||
|
// only be called on the UI thread.
|
||||||
|
///
|
||||||
|
typedef struct _cef_v8stack_trace_t
|
||||||
|
{
|
||||||
|
// Base structure.
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns the number of stack frames.
|
||||||
|
///
|
||||||
|
int (CEF_CALLBACK *get_frame_count)(struct _cef_v8stack_trace_t* self);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns the stack frame at the specified 0-based index.
|
||||||
|
///
|
||||||
|
struct _cef_v8stack_frame_t* (CEF_CALLBACK *get_frame)(
|
||||||
|
struct _cef_v8stack_trace_t* self, int index);
|
||||||
|
|
||||||
|
} cef_v8stack_trace_t;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns the stack trace for the currently active context. |frame_limit| is
|
||||||
|
// the maximum number of frames that will be captured.
|
||||||
|
///
|
||||||
|
CEF_EXPORT cef_v8stack_trace_t* cef_v8stack_trace_get_current(int frame_limit);
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
// Structure representing a V8 stack frame. The functions of this structure may
|
||||||
|
// only be called on the UI thread.
|
||||||
|
///
|
||||||
|
typedef struct _cef_v8stack_frame_t
|
||||||
|
{
|
||||||
|
// Base structure.
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns the name of the resource script that contains the function.
|
||||||
|
///
|
||||||
|
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||||
|
cef_string_userfree_t (CEF_CALLBACK *get_script_name)(
|
||||||
|
struct _cef_v8stack_frame_t* self);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns the name of the resource script that contains the function or the
|
||||||
|
// sourceURL value if the script name is undefined and its source ends with a
|
||||||
|
// "//@ sourceURL=..." string.
|
||||||
|
///
|
||||||
|
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||||
|
cef_string_userfree_t (CEF_CALLBACK *get_script_name_or_source_url)(
|
||||||
|
struct _cef_v8stack_frame_t* self);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns the name of the function.
|
||||||
|
///
|
||||||
|
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||||
|
cef_string_userfree_t (CEF_CALLBACK *get_function_name)(
|
||||||
|
struct _cef_v8stack_frame_t* self);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns the 1-based line number for the function call or 0 if unknown.
|
||||||
|
///
|
||||||
|
int (CEF_CALLBACK *get_line_number)(struct _cef_v8stack_frame_t* self);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns the 1-based column offset on the line for the function call or 0 if
|
||||||
|
// unknown.
|
||||||
|
///
|
||||||
|
int (CEF_CALLBACK *get_column)(struct _cef_v8stack_frame_t* self);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns true (1) if the function was compiled using eval().
|
||||||
|
///
|
||||||
|
int (CEF_CALLBACK *is_eval)(struct _cef_v8stack_frame_t* self);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns true (1) if the function was called as a constructor via "new".
|
||||||
|
///
|
||||||
|
int (CEF_CALLBACK *is_constructor)(struct _cef_v8stack_frame_t* self);
|
||||||
|
|
||||||
|
} cef_v8stack_frame_t;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Structure that creates cef_scheme_handler_t instances. The functions of this
|
// Structure that creates cef_scheme_handler_t instances. The functions of this
|
||||||
// structure will always be called on the IO thread.
|
// structure will always be called on the IO thread.
|
||||||
|
@@ -2,10 +2,23 @@
|
|||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "browser_impl.h"
|
#include <string>
|
||||||
#include "v8_impl.h"
|
|
||||||
#include "cef_context.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "tracker.h"
|
|
||||||
|
#include "third_party/WebKit/Source/WebCore/config.h"
|
||||||
|
MSVC_PUSH_WARNING_LEVEL(0);
|
||||||
|
#include "V8Proxy.h" // NOLINT(build/include)
|
||||||
|
MSVC_POP_WARNING();
|
||||||
|
#undef LOG
|
||||||
|
|
||||||
|
#include "libcef/v8_impl.h"
|
||||||
|
|
||||||
|
#include "libcef/browser_impl.h"
|
||||||
|
#include "libcef/cef_context.h"
|
||||||
|
#include "libcef/tracker.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
#include "base/lazy_instance.h"
|
#include "base/lazy_instance.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
||||||
@@ -135,6 +148,9 @@ void v8impl_string_dtor(char* str)
|
|||||||
// Convert a v8::String to CefString.
|
// Convert a v8::String to CefString.
|
||||||
void GetCefString(v8::Handle<v8::String> str, CefString& out)
|
void GetCefString(v8::Handle<v8::String> str, CefString& out)
|
||||||
{
|
{
|
||||||
|
if (str.IsEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
#if defined(CEF_STRING_TYPE_WIDE)
|
#if defined(CEF_STRING_TYPE_WIDE)
|
||||||
// Allocate enough space for a worst-case conversion.
|
// Allocate enough space for a worst-case conversion.
|
||||||
int len = str->Utf8Length();
|
int len = str->Utf8Length();
|
||||||
@@ -406,11 +422,11 @@ bool CefV8Context::InContext()
|
|||||||
// CefV8ContextImpl
|
// CefV8ContextImpl
|
||||||
|
|
||||||
CefV8ContextImpl::CefV8ContextImpl(v8::Handle<v8::Context> context)
|
CefV8ContextImpl::CefV8ContextImpl(v8::Handle<v8::Context> context)
|
||||||
|
: handle_(new Handle(context))
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
: enter_count_(0)
|
, enter_count_(0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
v8_context_ = new CefV8ContextHandle(context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CefV8ContextImpl::~CefV8ContextImpl()
|
CefV8ContextImpl::~CefV8ContextImpl()
|
||||||
@@ -451,14 +467,14 @@ CefRefPtr<CefV8Value> CefV8ContextImpl::GetGlobal()
|
|||||||
CEF_REQUIRE_UI_THREAD(NULL);
|
CEF_REQUIRE_UI_THREAD(NULL);
|
||||||
|
|
||||||
v8::HandleScope handle_scope;
|
v8::HandleScope handle_scope;
|
||||||
v8::Context::Scope context_scope(v8_context_->GetHandle());
|
v8::Context::Scope context_scope(GetHandle());
|
||||||
return new CefV8ValueImpl(v8_context_->GetHandle()->Global());
|
return new CefV8ValueImpl(GetHandle()->Global());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefV8ContextImpl::Enter()
|
bool CefV8ContextImpl::Enter()
|
||||||
{
|
{
|
||||||
CEF_REQUIRE_UI_THREAD(false);
|
CEF_REQUIRE_UI_THREAD(false);
|
||||||
v8_context_->GetHandle()->Enter();
|
GetHandle()->Enter();
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
++enter_count_;
|
++enter_count_;
|
||||||
#endif
|
#endif
|
||||||
@@ -469,7 +485,7 @@ bool CefV8ContextImpl::Exit()
|
|||||||
{
|
{
|
||||||
CEF_REQUIRE_UI_THREAD(false);
|
CEF_REQUIRE_UI_THREAD(false);
|
||||||
DLOG_ASSERT(enter_count_ > 0);
|
DLOG_ASSERT(enter_count_ > 0);
|
||||||
v8_context_->GetHandle()->Exit();
|
GetHandle()->Exit();
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
--enter_count_;
|
--enter_count_;
|
||||||
#endif
|
#endif
|
||||||
@@ -492,32 +508,77 @@ bool CefV8ContextImpl::IsSame(CefRefPtr<CefV8Context> that)
|
|||||||
return (thisHandle == thatHandle);
|
return (thisHandle == thatHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CefV8ContextImpl::Eval(const CefString& code,
|
||||||
|
CefRefPtr<CefV8Value>& retval,
|
||||||
|
CefRefPtr<CefV8Exception>& exception) {
|
||||||
|
CEF_REQUIRE_UI_THREAD(NULL);
|
||||||
|
|
||||||
|
if (code.empty()) {
|
||||||
|
NOTREACHED() << "invalid input parameter";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
v8::HandleScope handle_scope;
|
||||||
|
v8::Context::Scope context_scope(GetHandle());
|
||||||
|
v8::Local<v8::Object> obj = GetHandle()->Global();
|
||||||
|
|
||||||
|
// Retrieve the eval function.
|
||||||
|
v8::Local<v8::Value> val = obj->Get(v8::String::New("eval"));
|
||||||
|
if (val.IsEmpty() || !val->IsFunction())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(val);
|
||||||
|
v8::Handle<v8::Value> code_val = GetV8String(code);
|
||||||
|
|
||||||
|
v8::TryCatch try_catch;
|
||||||
|
try_catch.SetVerbose(true);
|
||||||
|
v8::Local<v8::Value> func_rv;
|
||||||
|
|
||||||
|
retval = NULL;
|
||||||
|
exception = NULL;
|
||||||
|
|
||||||
|
// Execute the function call using the V8Proxy so that inspector
|
||||||
|
// instrumentation works.
|
||||||
|
WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve();
|
||||||
|
DCHECK(proxy);
|
||||||
|
if (proxy)
|
||||||
|
func_rv = proxy->callFunction(func, obj, 1, &code_val);
|
||||||
|
|
||||||
|
if (try_catch.HasCaught()) {
|
||||||
|
exception = new CefV8ExceptionImpl(try_catch.Message());
|
||||||
|
return false;
|
||||||
|
} else if (!func_rv.IsEmpty()) {
|
||||||
|
retval = new CefV8ValueImpl(func_rv);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
v8::Local<v8::Context> CefV8ContextImpl::GetContext()
|
v8::Local<v8::Context> CefV8ContextImpl::GetContext()
|
||||||
{
|
{
|
||||||
return v8::Local<v8::Context>::New(v8_context_->GetHandle());
|
return v8::Local<v8::Context>::New(GetHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
WebKit::WebFrame* CefV8ContextImpl::GetWebFrame()
|
WebKit::WebFrame* CefV8ContextImpl::GetWebFrame()
|
||||||
{
|
{
|
||||||
v8::HandleScope handle_scope;
|
v8::HandleScope handle_scope;
|
||||||
v8::Context::Scope context_scope(v8_context_->GetHandle());
|
v8::Context::Scope context_scope(GetHandle());
|
||||||
WebKit::WebFrame* frame = WebKit::WebFrame::frameForCurrentContext();
|
WebKit::WebFrame* frame = WebKit::WebFrame::frameForCurrentContext();
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// CefV8ValueHandle
|
// CefV8ValueImpl::Handle
|
||||||
|
|
||||||
// Custom destructor for a v8 value handle which gets called only on the UI
|
// Custom destructor for a v8 value handle which gets called only on the UI
|
||||||
// thread.
|
// thread.
|
||||||
CefV8ValueHandle::~CefV8ValueHandle()
|
CefV8ValueImpl::Handle::~Handle()
|
||||||
{
|
{
|
||||||
if(tracker_) {
|
if(tracker_) {
|
||||||
TrackAdd(tracker_);
|
TrackAdd(tracker_);
|
||||||
v8_handle_.MakeWeak(tracker_, TrackDestructor);
|
handle_.MakeWeak(tracker_, TrackDestructor);
|
||||||
} else {
|
} else {
|
||||||
v8_handle_.Dispose();
|
handle_.Dispose();
|
||||||
v8_handle_.Clear();
|
handle_.Clear();
|
||||||
}
|
}
|
||||||
tracker_ = NULL;
|
tracker_ = NULL;
|
||||||
}
|
}
|
||||||
@@ -706,8 +767,7 @@ CefRefPtr<CefV8Value> CefV8Value::CreateFunction(const CefString& name,
|
|||||||
|
|
||||||
CefV8ValueImpl::CefV8ValueImpl(v8::Handle<v8::Value> value,
|
CefV8ValueImpl::CefV8ValueImpl(v8::Handle<v8::Value> value,
|
||||||
CefTrackObject* tracker)
|
CefTrackObject* tracker)
|
||||||
{
|
: handle_(new Handle(value, tracker)) {
|
||||||
v8_value_ = new CefV8ValueHandle(value, tracker);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CefV8ValueImpl::~CefV8ValueImpl()
|
CefV8ValueImpl::~CefV8ValueImpl()
|
||||||
@@ -1195,3 +1255,105 @@ CefV8Accessor* CefV8ValueImpl::GetAccessor(v8::Handle<v8::Object> object)
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CefV8StackTrace
|
||||||
|
|
||||||
|
// static
|
||||||
|
CefRefPtr<CefV8StackTrace> CefV8StackTrace::GetCurrent(int frame_limit) {
|
||||||
|
CEF_REQUIRE_VALID_CONTEXT(NULL);
|
||||||
|
CEF_REQUIRE_UI_THREAD(NULL);
|
||||||
|
|
||||||
|
v8::Handle<v8::StackTrace> stackTrace =
|
||||||
|
v8::StackTrace::CurrentStackTrace(
|
||||||
|
frame_limit, v8::StackTrace::kDetailed);
|
||||||
|
if (stackTrace.IsEmpty())
|
||||||
|
return NULL;
|
||||||
|
return new CefV8StackTraceImpl(stackTrace);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CefV8StackTraceImpl
|
||||||
|
|
||||||
|
CefV8StackTraceImpl::CefV8StackTraceImpl(v8::Handle<v8::StackTrace> handle)
|
||||||
|
: handle_(new Handle(handle)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
CefV8StackTraceImpl::~CefV8StackTraceImpl() {
|
||||||
|
}
|
||||||
|
|
||||||
|
int CefV8StackTraceImpl::GetFrameCount() {
|
||||||
|
CEF_REQUIRE_UI_THREAD(0);
|
||||||
|
v8::HandleScope handle_scope;
|
||||||
|
return GetHandle()->GetFrameCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
CefRefPtr<CefV8StackFrame> CefV8StackTraceImpl::GetFrame(int index) {
|
||||||
|
CEF_REQUIRE_UI_THREAD(NULL);
|
||||||
|
v8::HandleScope handle_scope;
|
||||||
|
v8::Handle<v8::StackFrame> stackFrame = GetHandle()->GetFrame(index);
|
||||||
|
if (stackFrame.IsEmpty())
|
||||||
|
return NULL;
|
||||||
|
return new CefV8StackFrameImpl(stackFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CefV8StackFrameImpl
|
||||||
|
|
||||||
|
CefV8StackFrameImpl::CefV8StackFrameImpl(v8::Handle<v8::StackFrame> handle)
|
||||||
|
: handle_(new Handle(handle)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
CefV8StackFrameImpl::~CefV8StackFrameImpl() {
|
||||||
|
}
|
||||||
|
|
||||||
|
CefString CefV8StackFrameImpl::GetScriptName() {
|
||||||
|
CefString rv;
|
||||||
|
CEF_REQUIRE_UI_THREAD(rv);
|
||||||
|
v8::HandleScope handle_scope;
|
||||||
|
GetCefString(v8::Handle<v8::String>::Cast(GetHandle()->GetScriptName()), rv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
CefString CefV8StackFrameImpl::GetScriptNameOrSourceURL() {
|
||||||
|
CefString rv;
|
||||||
|
CEF_REQUIRE_UI_THREAD(rv);
|
||||||
|
v8::HandleScope handle_scope;
|
||||||
|
GetCefString(
|
||||||
|
v8::Handle<v8::String>::Cast(GetHandle()->GetScriptNameOrSourceURL()),
|
||||||
|
rv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
CefString CefV8StackFrameImpl::GetFunctionName() {
|
||||||
|
CefString rv;
|
||||||
|
CEF_REQUIRE_UI_THREAD(rv);
|
||||||
|
v8::HandleScope handle_scope;
|
||||||
|
GetCefString(
|
||||||
|
v8::Handle<v8::String>::Cast(GetHandle()->GetFunctionName()), rv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CefV8StackFrameImpl::GetLineNumber() {
|
||||||
|
CEF_REQUIRE_UI_THREAD(0);
|
||||||
|
v8::HandleScope handle_scope;
|
||||||
|
return GetHandle()->GetLineNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CefV8StackFrameImpl::GetColumn() {
|
||||||
|
CEF_REQUIRE_UI_THREAD(0);
|
||||||
|
v8::HandleScope handle_scope;
|
||||||
|
return GetHandle()->GetColumn();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefV8StackFrameImpl::IsEval() {
|
||||||
|
CEF_REQUIRE_UI_THREAD(false);
|
||||||
|
v8::HandleScope handle_scope;
|
||||||
|
return GetHandle()->IsEval();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefV8StackFrameImpl::IsConstructor() {
|
||||||
|
CEF_REQUIRE_UI_THREAD(false);
|
||||||
|
v8::HandleScope handle_scope;
|
||||||
|
return GetHandle()->IsConstructor();
|
||||||
|
}
|
||||||
|
168
libcef/v8_impl.h
168
libcef/v8_impl.h
@@ -5,8 +5,12 @@
|
|||||||
#ifndef _V8_IMPL_H
|
#ifndef _V8_IMPL_H
|
||||||
#define _V8_IMPL_H
|
#define _V8_IMPL_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "include/cef.h"
|
#include "include/cef.h"
|
||||||
#include "v8/include/v8.h"
|
#include "v8/include/v8.h"
|
||||||
|
#include "libcef/cef_thread.h"
|
||||||
|
#include "base/memory/ref_counted.h"
|
||||||
|
|
||||||
class CefTrackObject;
|
class CefTrackObject;
|
||||||
|
|
||||||
@@ -16,53 +20,40 @@ class WebFrame;
|
|||||||
|
|
||||||
// Template for V8 Handle types. This class is used to ensure that V8 objects
|
// Template for V8 Handle types. This class is used to ensure that V8 objects
|
||||||
// are only released on the UI thread.
|
// are only released on the UI thread.
|
||||||
template <class v8class>
|
template <typename v8class>
|
||||||
class CefReleaseV8HandleOnUIThread:
|
class CefV8Handle :
|
||||||
public base::RefCountedThreadSafe<CefReleaseV8HandleOnUIThread<v8class>,
|
public base::RefCountedThreadSafe<CefV8Handle<v8class>,
|
||||||
CefThread::DeleteOnUIThread>
|
CefThread::DeleteOnUIThread> {
|
||||||
{
|
public:
|
||||||
public:
|
|
||||||
typedef v8::Handle<v8class> handleType;
|
typedef v8::Handle<v8class> handleType;
|
||||||
typedef v8::Persistent<v8class> persistentType;
|
typedef v8::Persistent<v8class> persistentType;
|
||||||
typedef CefReleaseV8HandleOnUIThread<v8class> superType;
|
|
||||||
|
|
||||||
CefReleaseV8HandleOnUIThread(handleType v)
|
CefV8Handle(handleType v)
|
||||||
{
|
: handle_(persistentType::New(v)) {
|
||||||
v8_handle_ = persistentType::New(v);
|
|
||||||
}
|
}
|
||||||
virtual ~CefReleaseV8HandleOnUIThread()
|
~CefV8Handle() {
|
||||||
{
|
handle_.Dispose();
|
||||||
|
handle_.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleType GetHandle()
|
handleType GetHandle() { return handle_; }
|
||||||
{
|
|
||||||
return v8_handle_;
|
|
||||||
}
|
|
||||||
|
|
||||||
persistentType v8_handle_;
|
protected:
|
||||||
|
persistentType handle_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefV8Handle);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Special class for a v8::Context to ensure that it is deleted from the UI
|
// Specialization for v8::Value with empty implementation to avoid incorrect
|
||||||
// thread.
|
// usage.
|
||||||
class CefV8ContextHandle : public CefReleaseV8HandleOnUIThread<v8::Context>
|
template <>
|
||||||
{
|
class CefV8Handle<v8::Value> {
|
||||||
public:
|
|
||||||
CefV8ContextHandle(handleType context): superType(context)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Context handles are disposed rather than makeweak.
|
|
||||||
~CefV8ContextHandle()
|
|
||||||
{
|
|
||||||
v8_handle_.Dispose();
|
|
||||||
v8_handle_.Clear();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CefV8ContextImpl : public CefV8Context
|
|
||||||
{
|
class CefV8ContextImpl : public CefV8Context {
|
||||||
public:
|
public:
|
||||||
CefV8ContextImpl(v8::Handle<v8::Context> context);
|
explicit CefV8ContextImpl(v8::Handle<v8::Context> context);
|
||||||
virtual ~CefV8ContextImpl();
|
virtual ~CefV8ContextImpl();
|
||||||
|
|
||||||
virtual CefRefPtr<CefBrowser> GetBrowser() OVERRIDE;
|
virtual CefRefPtr<CefBrowser> GetBrowser() OVERRIDE;
|
||||||
@@ -71,12 +62,18 @@ public:
|
|||||||
virtual bool Enter() OVERRIDE;
|
virtual bool Enter() OVERRIDE;
|
||||||
virtual bool Exit() OVERRIDE;
|
virtual bool Exit() OVERRIDE;
|
||||||
virtual bool IsSame(CefRefPtr<CefV8Context> that) OVERRIDE;
|
virtual bool IsSame(CefRefPtr<CefV8Context> that) OVERRIDE;
|
||||||
|
virtual bool Eval(const CefString& code,
|
||||||
|
CefRefPtr<CefV8Value>& retval,
|
||||||
|
CefRefPtr<CefV8Exception>& exception) OVERRIDE;
|
||||||
|
|
||||||
v8::Local<v8::Context> GetContext();
|
v8::Local<v8::Context> GetContext();
|
||||||
WebKit::WebFrame* GetWebFrame();
|
WebKit::WebFrame* GetWebFrame();
|
||||||
|
|
||||||
|
v8::Handle<v8::Context> GetHandle() { return handle_->GetHandle(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
scoped_refptr<CefV8ContextHandle> v8_context_;
|
typedef CefV8Handle<v8::Context> Handle;
|
||||||
|
scoped_refptr<Handle> handle_;
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// Used in debug builds to catch missing Exits in destructor.
|
// Used in debug builds to catch missing Exits in destructor.
|
||||||
@@ -86,27 +83,8 @@ protected:
|
|||||||
IMPLEMENT_REFCOUNTING(CefV8ContextImpl);
|
IMPLEMENT_REFCOUNTING(CefV8ContextImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Special class for a v8::Value to ensure that it is deleted from the UI
|
class CefV8ValueImpl : public CefV8Value {
|
||||||
// thread.
|
public:
|
||||||
class CefV8ValueHandle: public CefReleaseV8HandleOnUIThread<v8::Value>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CefV8ValueHandle(handleType value, CefTrackObject* tracker)
|
|
||||||
: superType(value), tracker_(tracker)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
// Destructor implementation is provided in v8_impl.cc.
|
|
||||||
~CefV8ValueHandle();
|
|
||||||
|
|
||||||
private:
|
|
||||||
// For Object and Function types, we need to hold on to a reference to their
|
|
||||||
// internal data or function handler objects that are reference counted.
|
|
||||||
CefTrackObject *tracker_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CefV8ValueImpl : public CefV8Value
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CefV8ValueImpl(v8::Handle<v8::Value> value, CefTrackObject* tracker = NULL);
|
CefV8ValueImpl(v8::Handle<v8::Value> value, CefTrackObject* tracker = NULL);
|
||||||
virtual ~CefV8ValueImpl();
|
virtual ~CefV8ValueImpl();
|
||||||
|
|
||||||
@@ -155,19 +133,79 @@ public:
|
|||||||
CefRefPtr<CefV8Exception>& exception,
|
CefRefPtr<CefV8Exception>& exception,
|
||||||
bool rethrow_exception) OVERRIDE;
|
bool rethrow_exception) OVERRIDE;
|
||||||
|
|
||||||
inline v8::Handle<v8::Value> GetHandle()
|
v8::Handle<v8::Value> GetHandle() { return handle_->GetHandle(); }
|
||||||
{
|
|
||||||
DCHECK(v8_value_.get());
|
|
||||||
return v8_value_->GetHandle();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the accessor assigned for the specified object, if any.
|
// Returns the accessor assigned for the specified object, if any.
|
||||||
static CefV8Accessor* GetAccessor(v8::Handle<v8::Object> object);
|
static CefV8Accessor* GetAccessor(v8::Handle<v8::Object> object);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
scoped_refptr<CefV8ValueHandle> v8_value_;
|
class Handle :
|
||||||
|
public base::RefCountedThreadSafe<Handle, CefThread::DeleteOnUIThread> {
|
||||||
|
public:
|
||||||
|
typedef v8::Handle<v8::Value> handleType;
|
||||||
|
typedef v8::Persistent<v8::Value> persistentType;
|
||||||
|
|
||||||
|
Handle(handleType v, CefTrackObject* tracker)
|
||||||
|
: handle_(persistentType::New(v)),
|
||||||
|
tracker_(tracker) {
|
||||||
|
}
|
||||||
|
~Handle();
|
||||||
|
|
||||||
|
handleType GetHandle() { return handle_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
persistentType handle_;
|
||||||
|
|
||||||
|
// For Object and Function types, we need to hold on to a reference to their
|
||||||
|
// internal data or function handler objects that are reference counted.
|
||||||
|
CefTrackObject* tracker_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(Handle);
|
||||||
|
};
|
||||||
|
scoped_refptr<Handle> handle_;
|
||||||
|
|
||||||
IMPLEMENT_REFCOUNTING(CefV8ValueImpl);
|
IMPLEMENT_REFCOUNTING(CefV8ValueImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CefV8StackTraceImpl : public CefV8StackTrace {
|
||||||
|
public:
|
||||||
|
explicit CefV8StackTraceImpl(v8::Handle<v8::StackTrace> handle);
|
||||||
|
virtual ~CefV8StackTraceImpl();
|
||||||
|
|
||||||
|
virtual int GetFrameCount() OVERRIDE;
|
||||||
|
virtual CefRefPtr<CefV8StackFrame> GetFrame(int index) OVERRIDE;
|
||||||
|
|
||||||
|
v8::Handle<v8::StackTrace> GetHandle() { return handle_->GetHandle(); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
typedef CefV8Handle<v8::StackTrace> Handle;
|
||||||
|
scoped_refptr<Handle> handle_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefV8StackTraceImpl);
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefV8StackTraceImpl);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CefV8StackFrameImpl : public CefV8StackFrame {
|
||||||
|
public:
|
||||||
|
explicit CefV8StackFrameImpl(v8::Handle<v8::StackFrame> handle);
|
||||||
|
virtual ~CefV8StackFrameImpl();
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
v8::Handle<v8::StackFrame> GetHandle() { return handle_->GetHandle(); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
typedef CefV8Handle<v8::StackFrame> Handle;
|
||||||
|
scoped_refptr<Handle> handle_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefV8StackFrameImpl);
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefV8StackFrameImpl);
|
||||||
|
};
|
||||||
|
|
||||||
#endif //_V8_IMPL_H
|
#endif //_V8_IMPL_H
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/v8context_cpptoc.h"
|
#include "libcef_dll/cpptoc/v8context_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/v8exception_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/v8value_cpptoc.h"
|
#include "libcef_dll/cpptoc/v8value_cpptoc.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -160,6 +161,71 @@ int CEF_CALLBACK v8context_is_same(struct _cef_v8context_t* self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int CEF_CALLBACK v8context_eval(struct _cef_v8context_t* self,
|
||||||
|
const cef_string_t* code, struct _cef_v8value_t** retval,
|
||||||
|
struct _cef_v8exception_t** exception)
|
||||||
|
{
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return 0;
|
||||||
|
// Verify param: code; type: string_byref_const
|
||||||
|
DCHECK(code);
|
||||||
|
if (!code)
|
||||||
|
return 0;
|
||||||
|
// Verify param: retval; type: refptr_same_byref
|
||||||
|
DCHECK(retval);
|
||||||
|
if (!retval)
|
||||||
|
return 0;
|
||||||
|
// Verify param: exception; type: refptr_same_byref
|
||||||
|
DCHECK(exception);
|
||||||
|
if (!exception)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Translate param: retval; type: refptr_same_byref
|
||||||
|
CefRefPtr<CefV8Value> retvalPtr;
|
||||||
|
if (retval && *retval)
|
||||||
|
retvalPtr = CefV8ValueCppToC::Unwrap(*retval);
|
||||||
|
CefV8Value* retvalOrig = retvalPtr.get();
|
||||||
|
// Translate param: exception; type: refptr_same_byref
|
||||||
|
CefRefPtr<CefV8Exception> exceptionPtr;
|
||||||
|
if (exception && *exception)
|
||||||
|
exceptionPtr = CefV8ExceptionCppToC::Unwrap(*exception);
|
||||||
|
CefV8Exception* exceptionOrig = exceptionPtr.get();
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
bool _retval = CefV8ContextCppToC::Get(self)->Eval(
|
||||||
|
CefString(code),
|
||||||
|
retvalPtr,
|
||||||
|
exceptionPtr);
|
||||||
|
|
||||||
|
// Restore param: retval; type: refptr_same_byref
|
||||||
|
if (retval) {
|
||||||
|
if (retvalPtr.get()) {
|
||||||
|
if (retvalPtr.get() != retvalOrig) {
|
||||||
|
*retval = CefV8ValueCppToC::Wrap(retvalPtr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*retval = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Restore param: exception; type: refptr_same_byref
|
||||||
|
if (exception) {
|
||||||
|
if (exceptionPtr.get()) {
|
||||||
|
if (exceptionPtr.get() != exceptionOrig) {
|
||||||
|
*exception = CefV8ExceptionCppToC::Wrap(exceptionPtr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*exception = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// CONSTRUCTOR - Do not edit by hand.
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
@@ -172,6 +238,7 @@ CefV8ContextCppToC::CefV8ContextCppToC(CefV8Context* cls)
|
|||||||
struct_.struct_.enter = v8context_enter;
|
struct_.struct_.enter = v8context_enter;
|
||||||
struct_.struct_.exit = v8context_exit;
|
struct_.struct_.exit = v8context_exit;
|
||||||
struct_.struct_.is_same = v8context_is_same;
|
struct_.struct_.is_same = v8context_is_same;
|
||||||
|
struct_.struct_.eval = v8context_eval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
156
libcef_dll/cpptoc/v8stack_frame_cpptoc.cc
Normal file
156
libcef_dll/cpptoc/v8stack_frame_cpptoc.cc
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
// 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
|
||||||
|
|
37
libcef_dll/cpptoc/v8stack_frame_cpptoc.h
Normal file
37
libcef_dll/cpptoc/v8stack_frame_cpptoc.h
Normal 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 _V8STACKFRAME_CPPTOC_H
|
||||||
|
#define _V8STACKFRAME_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef BUILDING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
|
||||||
|
#else // BUILDING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_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:
|
||||||
|
CefV8StackFrameCppToC(CefV8StackFrame* cls);
|
||||||
|
virtual ~CefV8StackFrameCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BUILDING_CEF_SHARED
|
||||||
|
#endif // _V8STACKFRAME_CPPTOC_H
|
||||||
|
|
86
libcef_dll/cpptoc/v8stack_trace_cpptoc.cc
Normal file
86
libcef_dll/cpptoc/v8stack_trace_cpptoc.cc
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
// 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
|
||||||
|
|
37
libcef_dll/cpptoc/v8stack_trace_cpptoc.h
Normal file
37
libcef_dll/cpptoc/v8stack_trace_cpptoc.h
Normal 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 _V8STACKTRACE_CPPTOC_H
|
||||||
|
#define _V8STACKTRACE_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef BUILDING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
|
||||||
|
#else // BUILDING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_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:
|
||||||
|
CefV8StackTraceCppToC(CefV8StackTrace* cls);
|
||||||
|
virtual ~CefV8StackTraceCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BUILDING_CEF_SHARED
|
||||||
|
#endif // _V8STACKTRACE_CPPTOC_H
|
||||||
|
|
@@ -13,6 +13,7 @@
|
|||||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/v8context_ctocpp.h"
|
#include "libcef_dll/ctocpp/v8context_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/v8exception_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/v8value_ctocpp.h"
|
#include "libcef_dll/ctocpp/v8value_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -153,6 +154,58 @@ bool CefV8ContextCToCpp::IsSame(CefRefPtr<CefV8Context> that)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CefV8ContextCToCpp::Eval(const CefString& code,
|
||||||
|
CefRefPtr<CefV8Value>& retval, CefRefPtr<CefV8Exception>& exception)
|
||||||
|
{
|
||||||
|
if (CEF_MEMBER_MISSING(struct_, eval))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: code; type: string_byref_const
|
||||||
|
DCHECK(!code.empty());
|
||||||
|
if (code.empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Translate param: retval; type: refptr_same_byref
|
||||||
|
cef_v8value_t* retvalStruct = NULL;
|
||||||
|
if(retval.get())
|
||||||
|
retvalStruct = CefV8ValueCToCpp::Unwrap(retval);
|
||||||
|
cef_v8value_t* retvalOrig = retvalStruct;
|
||||||
|
// Translate param: exception; type: refptr_same_byref
|
||||||
|
cef_v8exception_t* exceptionStruct = NULL;
|
||||||
|
if(exception.get())
|
||||||
|
exceptionStruct = CefV8ExceptionCToCpp::Unwrap(exception);
|
||||||
|
cef_v8exception_t* exceptionOrig = exceptionStruct;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int _retval = struct_->eval(struct_,
|
||||||
|
code.GetStruct(),
|
||||||
|
&retvalStruct,
|
||||||
|
&exceptionStruct);
|
||||||
|
|
||||||
|
// Restore param:retval; type: refptr_same_byref
|
||||||
|
if (retvalStruct) {
|
||||||
|
if (retvalStruct != retvalOrig) {
|
||||||
|
retval = CefV8ValueCToCpp::Wrap(retvalStruct);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
retval = NULL;
|
||||||
|
}
|
||||||
|
// Restore param:exception; type: refptr_same_byref
|
||||||
|
if (exceptionStruct) {
|
||||||
|
if (exceptionStruct != exceptionOrig) {
|
||||||
|
exception = CefV8ExceptionCToCpp::Wrap(exceptionStruct);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
exception = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval?true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCToCpp<CefV8ContextCToCpp, CefV8Context,
|
template<> long CefCToCpp<CefV8ContextCToCpp, CefV8Context,
|
||||||
|
@@ -38,6 +38,8 @@ public:
|
|||||||
virtual bool Enter() OVERRIDE;
|
virtual bool Enter() OVERRIDE;
|
||||||
virtual bool Exit() OVERRIDE;
|
virtual bool Exit() OVERRIDE;
|
||||||
virtual bool IsSame(CefRefPtr<CefV8Context> that) OVERRIDE;
|
virtual bool IsSame(CefRefPtr<CefV8Context> that) OVERRIDE;
|
||||||
|
virtual bool Eval(const CefString& code, CefRefPtr<CefV8Value>& retval,
|
||||||
|
CefRefPtr<CefV8Exception>& exception) OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // USING_CEF_SHARED
|
#endif // USING_CEF_SHARED
|
||||||
|
135
libcef_dll/ctocpp/v8stack_frame_ctocpp.cc
Normal file
135
libcef_dll/ctocpp/v8stack_frame_ctocpp.cc
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
// 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
|
||||||
|
|
48
libcef_dll/ctocpp/v8stack_frame_ctocpp.h
Normal file
48
libcef_dll/ctocpp/v8stack_frame_ctocpp.h
Normal 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 _V8STACKFRAME_CTOCPP_H
|
||||||
|
#define _V8STACKFRAME_CTOCPP_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_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:
|
||||||
|
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 // _V8STACKFRAME_CTOCPP_H
|
||||||
|
|
71
libcef_dll/ctocpp/v8stack_trace_ctocpp.cc
Normal file
71
libcef_dll/ctocpp/v8stack_trace_ctocpp.cc
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
// 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
|
||||||
|
|
43
libcef_dll/ctocpp/v8stack_trace_ctocpp.h
Normal file
43
libcef_dll/ctocpp/v8stack_trace_ctocpp.h
Normal 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 _V8STACKTRACE_CTOCPP_H
|
||||||
|
#define _V8STACKTRACE_CTOCPP_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_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:
|
||||||
|
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 // _V8STACKTRACE_CTOCPP_H
|
||||||
|
|
@@ -27,6 +27,8 @@
|
|||||||
#include "libcef_dll/cpptoc/stream_writer_cpptoc.h"
|
#include "libcef_dll/cpptoc/stream_writer_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/v8context_cpptoc.h"
|
#include "libcef_dll/cpptoc/v8context_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/v8exception_cpptoc.h"
|
#include "libcef_dll/cpptoc/v8exception_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/v8stack_frame_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/v8stack_trace_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/v8value_cpptoc.h"
|
#include "libcef_dll/cpptoc/v8value_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h"
|
#include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/web_urlrequest_cpptoc.h"
|
#include "libcef_dll/cpptoc/web_urlrequest_cpptoc.h"
|
||||||
@@ -147,6 +149,8 @@ CEF_EXPORT void cef_shutdown()
|
|||||||
DCHECK(CefV8ContextHandlerCToCpp::DebugObjCt == 0);
|
DCHECK(CefV8ContextHandlerCToCpp::DebugObjCt == 0);
|
||||||
DCHECK(CefV8ExceptionCppToC::DebugObjCt == 0);
|
DCHECK(CefV8ExceptionCppToC::DebugObjCt == 0);
|
||||||
DCHECK(CefV8HandlerCToCpp::DebugObjCt == 0);
|
DCHECK(CefV8HandlerCToCpp::DebugObjCt == 0);
|
||||||
|
DCHECK(CefV8StackFrameCppToC::DebugObjCt == 0);
|
||||||
|
DCHECK(CefV8StackTraceCppToC::DebugObjCt == 0);
|
||||||
DCHECK(CefV8ValueCppToC::DebugObjCt == 0);
|
DCHECK(CefV8ValueCppToC::DebugObjCt == 0);
|
||||||
DCHECK(CefWebPluginInfoCppToC::DebugObjCt == 0);
|
DCHECK(CefWebPluginInfoCppToC::DebugObjCt == 0);
|
||||||
DCHECK(CefWebURLRequestClientCToCpp::DebugObjCt == 0);
|
DCHECK(CefWebURLRequestClientCToCpp::DebugObjCt == 0);
|
||||||
|
@@ -59,6 +59,8 @@
|
|||||||
#include "libcef_dll/ctocpp/stream_writer_ctocpp.h"
|
#include "libcef_dll/ctocpp/stream_writer_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/v8context_ctocpp.h"
|
#include "libcef_dll/ctocpp/v8context_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/v8exception_ctocpp.h"
|
#include "libcef_dll/ctocpp/v8exception_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/v8stack_frame_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/v8stack_trace_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/v8value_ctocpp.h"
|
#include "libcef_dll/ctocpp/v8value_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h"
|
#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/web_urlrequest_ctocpp.h"
|
#include "libcef_dll/ctocpp/web_urlrequest_ctocpp.h"
|
||||||
@@ -149,6 +151,8 @@ CEF_GLOBAL void CefShutdown()
|
|||||||
DCHECK(CefV8ContextHandlerCppToC::DebugObjCt == 0);
|
DCHECK(CefV8ContextHandlerCppToC::DebugObjCt == 0);
|
||||||
DCHECK(CefV8ExceptionCToCpp::DebugObjCt == 0);
|
DCHECK(CefV8ExceptionCToCpp::DebugObjCt == 0);
|
||||||
DCHECK(CefV8HandlerCppToC::DebugObjCt == 0);
|
DCHECK(CefV8HandlerCppToC::DebugObjCt == 0);
|
||||||
|
DCHECK(CefV8StackFrameCToCpp::DebugObjCt == 0);
|
||||||
|
DCHECK(CefV8StackTraceCToCpp::DebugObjCt == 0);
|
||||||
DCHECK(CefV8ValueCToCpp::DebugObjCt == 0);
|
DCHECK(CefV8ValueCToCpp::DebugObjCt == 0);
|
||||||
DCHECK(CefWebPluginInfoCToCpp::DebugObjCt == 0);
|
DCHECK(CefWebPluginInfoCToCpp::DebugObjCt == 0);
|
||||||
DCHECK(CefWebURLRequestCToCpp::DebugObjCt == 0);
|
DCHECK(CefWebURLRequestCToCpp::DebugObjCt == 0);
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user