2013-01-03 18:24:24 +01:00
|
|
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
2012-04-03 03:34:16 +02:00
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_RENDERER_V8_IMPL_H_
|
|
|
|
#define CEF_LIBCEF_RENDERER_V8_IMPL_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "include/cef_v8.h"
|
2012-10-30 21:49:43 +01:00
|
|
|
#include "libcef/common/tracker.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2012-12-30 22:16:59 +01:00
|
|
|
#include "base/location.h"
|
|
|
|
#include "base/logging.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "base/memory/ref_counted.h"
|
2017-09-21 13:57:40 +02:00
|
|
|
#include "base/single_thread_task_runner.h"
|
2017-05-17 11:29:28 +02:00
|
|
|
#include "v8/include/v8.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
class CefTrackNode;
|
2013-01-03 18:24:24 +01:00
|
|
|
class GURL;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2013-11-08 22:28:56 +01:00
|
|
|
namespace blink {
|
2017-07-27 01:19:27 +02:00
|
|
|
class WebLocalFrame;
|
2019-03-13 22:27:37 +01:00
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2013-01-03 18:24:24 +01:00
|
|
|
// Call after a V8 Isolate has been created and entered for the first time.
|
|
|
|
void CefV8IsolateCreated();
|
|
|
|
|
|
|
|
// Call before a V8 Isolate is exited and destroyed.
|
|
|
|
void CefV8IsolateDestroyed();
|
|
|
|
|
|
|
|
// Call to detach all handles associated with the specified context.
|
2015-04-20 13:11:11 +02:00
|
|
|
void CefV8ReleaseContext(v8::Local<v8::Context> context);
|
2012-10-29 22:46:02 +01:00
|
|
|
|
2013-01-03 18:24:24 +01:00
|
|
|
// Set the stack size for uncaught exceptions.
|
|
|
|
void CefV8SetUncaughtExceptionStackSize(int stack_size);
|
|
|
|
|
|
|
|
// Set attributes associated with a WebWorker thread.
|
|
|
|
void CefV8SetWorkerAttributes(int worker_id, const GURL& worker_url);
|
|
|
|
|
2012-10-29 22:46:02 +01:00
|
|
|
// Used to detach handles when the associated context is released.
|
|
|
|
class CefV8ContextState : public base::RefCounted<CefV8ContextState> {
|
|
|
|
public:
|
|
|
|
CefV8ContextState() : valid_(true) {}
|
|
|
|
|
|
|
|
bool IsValid() { return valid_; }
|
2012-10-30 21:49:43 +01:00
|
|
|
void Detach() {
|
|
|
|
DCHECK(valid_);
|
|
|
|
valid_ = false;
|
|
|
|
track_manager_.DeleteAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddTrackObject(CefTrackNode* object) {
|
|
|
|
DCHECK(valid_);
|
|
|
|
track_manager_.Add(object);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DeleteTrackObject(CefTrackNode* object) {
|
|
|
|
DCHECK(valid_);
|
|
|
|
track_manager_.Delete(object);
|
|
|
|
}
|
2012-10-29 22:46:02 +01:00
|
|
|
|
|
|
|
private:
|
2014-11-12 20:25:15 +01:00
|
|
|
friend class base::RefCounted<CefV8ContextState>;
|
|
|
|
|
|
|
|
~CefV8ContextState() {}
|
|
|
|
|
2012-10-29 22:46:02 +01:00
|
|
|
bool valid_;
|
2012-10-30 21:49:43 +01:00
|
|
|
CefTrackManager track_manager_;
|
2012-10-29 22:46:02 +01:00
|
|
|
};
|
|
|
|
|
2012-12-30 22:16:59 +01:00
|
|
|
// Use this template in conjuction with RefCountedThreadSafe to ensure that a
|
|
|
|
// V8 object is deleted on the correct thread.
|
|
|
|
struct CefV8DeleteOnMessageLoopThread {
|
2017-05-17 11:29:28 +02:00
|
|
|
template <typename T>
|
2012-12-30 22:16:59 +01:00
|
|
|
static void Destruct(const T* x) {
|
2017-09-06 23:40:58 +02:00
|
|
|
if (x->task_runner()->RunsTasksInCurrentSequence()) {
|
2012-12-30 22:16:59 +01:00
|
|
|
delete x;
|
|
|
|
} else {
|
2013-01-03 18:24:24 +01:00
|
|
|
if (!x->task_runner()->DeleteSoon(FROM_HERE, x)) {
|
2012-12-30 22:16:59 +01:00
|
|
|
#if defined(UNIT_TEST)
|
|
|
|
// Only logged under unit testing because leaks at shutdown
|
|
|
|
// are acceptable under normal circumstances.
|
|
|
|
LOG(ERROR) << "DeleteSoon failed on thread " << thread;
|
|
|
|
#endif // UNIT_TEST
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-10-29 22:46:02 +01:00
|
|
|
// Base class for V8 Handle types.
|
2017-05-17 11:29:28 +02:00
|
|
|
class CefV8HandleBase
|
|
|
|
: public base::RefCountedThreadSafe<CefV8HandleBase,
|
|
|
|
CefV8DeleteOnMessageLoopThread> {
|
2012-10-29 22:46:02 +01:00
|
|
|
public:
|
|
|
|
// Returns true if there is no underlying context or if the underlying context
|
|
|
|
// is valid.
|
2012-12-30 22:16:59 +01:00
|
|
|
bool IsValid() const {
|
2012-10-29 22:46:02 +01:00
|
|
|
return (!context_state_.get() || context_state_->IsValid());
|
|
|
|
}
|
|
|
|
|
2012-12-30 22:16:59 +01:00
|
|
|
bool BelongsToCurrentThread() const;
|
|
|
|
|
2013-03-12 21:23:24 +01:00
|
|
|
v8::Isolate* isolate() const { return isolate_; }
|
2017-09-21 13:57:40 +02:00
|
|
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner() const {
|
2013-01-03 18:24:24 +01:00
|
|
|
return task_runner_;
|
|
|
|
}
|
|
|
|
|
2012-10-29 22:46:02 +01:00
|
|
|
protected:
|
2014-11-12 20:25:15 +01:00
|
|
|
friend class base::DeleteHelper<CefV8HandleBase>;
|
|
|
|
friend class base::RefCountedThreadSafe<CefV8HandleBase,
|
|
|
|
CefV8DeleteOnMessageLoopThread>;
|
|
|
|
friend struct CefV8DeleteOnMessageLoopThread;
|
|
|
|
|
2012-10-29 22:46:02 +01:00
|
|
|
// |context| is the context that owns this handle. If empty the current
|
|
|
|
// context will be used.
|
2017-05-17 11:29:28 +02:00
|
|
|
CefV8HandleBase(v8::Isolate* isolate, v8::Local<v8::Context> context);
|
2014-11-12 20:25:15 +01:00
|
|
|
virtual ~CefV8HandleBase();
|
2012-10-29 22:46:02 +01:00
|
|
|
|
2012-10-30 21:49:43 +01:00
|
|
|
protected:
|
2013-03-12 21:23:24 +01:00
|
|
|
v8::Isolate* isolate_;
|
2017-09-21 13:57:40 +02:00
|
|
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
|
2012-10-29 22:46:02 +01:00
|
|
|
scoped_refptr<CefV8ContextState> context_state_;
|
|
|
|
};
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// Template for V8 Handle types. This class is used to ensure that V8 objects
|
2012-07-25 13:50:35 +02:00
|
|
|
// are only released on the render thread.
|
|
|
|
template <typename v8class>
|
2012-10-29 22:46:02 +01:00
|
|
|
class CefV8Handle : public CefV8HandleBase {
|
2012-04-03 03:34:16 +02:00
|
|
|
public:
|
2014-02-05 21:35:45 +01:00
|
|
|
typedef v8::Local<v8class> handleType;
|
2012-04-03 03:34:16 +02:00
|
|
|
typedef v8::Persistent<v8class> persistentType;
|
|
|
|
|
2013-12-17 23:04:35 +01:00
|
|
|
CefV8Handle(v8::Isolate* isolate,
|
2015-04-20 13:11:11 +02:00
|
|
|
v8::Local<v8::Context> context,
|
2013-12-17 23:04:35 +01:00
|
|
|
handleType v)
|
2017-05-17 11:29:28 +02:00
|
|
|
: CefV8HandleBase(isolate, context), handle_(isolate, v) {}
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2013-06-27 00:33:44 +02:00
|
|
|
handleType GetNewV8Handle() {
|
2012-10-29 22:46:02 +01:00
|
|
|
DCHECK(IsValid());
|
2013-06-27 00:33:44 +02:00
|
|
|
return handleType::New(isolate(), handle_);
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
persistentType& GetPersistentV8Handle() { return handle_; }
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2012-07-25 13:50:35 +02:00
|
|
|
protected:
|
2017-05-17 11:29:28 +02:00
|
|
|
~CefV8Handle() override { handle_.Reset(); }
|
2014-11-12 20:25:15 +01:00
|
|
|
|
2012-07-25 13:50:35 +02:00
|
|
|
persistentType handle_;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2012-07-25 13:50:35 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefV8Handle);
|
|
|
|
};
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2012-07-25 13:50:35 +02:00
|
|
|
// Specialization for v8::Value with empty implementation to avoid incorrect
|
|
|
|
// usage.
|
|
|
|
template <>
|
2017-05-17 11:29:28 +02:00
|
|
|
class CefV8Handle<v8::Value> {};
|
2012-07-25 13:50:35 +02:00
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
class CefV8ContextImpl : public CefV8Context {
|
|
|
|
public:
|
2017-05-17 11:29:28 +02:00
|
|
|
CefV8ContextImpl(v8::Isolate* isolate, v8::Local<v8::Context> context);
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefV8ContextImpl() override;
|
|
|
|
|
|
|
|
CefRefPtr<CefTaskRunner> GetTaskRunner() override;
|
|
|
|
bool IsValid() override;
|
|
|
|
CefRefPtr<CefBrowser> GetBrowser() override;
|
|
|
|
CefRefPtr<CefFrame> GetFrame() override;
|
|
|
|
CefRefPtr<CefV8Value> GetGlobal() override;
|
|
|
|
bool Enter() override;
|
|
|
|
bool Exit() override;
|
|
|
|
bool IsSame(CefRefPtr<CefV8Context> that) override;
|
|
|
|
bool Eval(const CefString& code,
|
2016-10-27 18:34:19 +02:00
|
|
|
const CefString& script_url,
|
|
|
|
int start_line,
|
2014-11-12 20:25:15 +01:00
|
|
|
CefRefPtr<CefV8Value>& retval,
|
|
|
|
CefRefPtr<CefV8Exception>& exception) override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2015-04-20 13:11:11 +02:00
|
|
|
v8::Local<v8::Context> GetV8Context();
|
2017-07-27 01:19:27 +02:00
|
|
|
blink::WebLocalFrame* GetWebFrame();
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2016-03-16 03:55:59 +01:00
|
|
|
private:
|
2012-07-25 13:50:35 +02:00
|
|
|
typedef CefV8Handle<v8::Context> Handle;
|
|
|
|
scoped_refptr<Handle> handle_;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
int enter_count_;
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<v8::MicrotasksScope> microtasks_scope_;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
IMPLEMENT_REFCOUNTING(CefV8ContextImpl);
|
2012-07-25 13:50:35 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefV8ContextImpl);
|
2012-04-03 03:34:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class CefV8ValueImpl : public CefV8Value {
|
|
|
|
public:
|
2013-12-17 23:04:35 +01:00
|
|
|
explicit CefV8ValueImpl(v8::Isolate* isolate);
|
|
|
|
CefV8ValueImpl(v8::Isolate* isolate,
|
2016-01-06 20:20:54 +01:00
|
|
|
v8::Local<v8::Context> context,
|
2015-04-20 13:11:11 +02:00
|
|
|
v8::Local<v8::Value> value);
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefV8ValueImpl() override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2013-06-27 00:33:44 +02:00
|
|
|
// Used for initializing the CefV8ValueImpl. Should be called a single time
|
|
|
|
// after the CefV8ValueImpl is created.
|
2016-01-06 20:20:54 +01:00
|
|
|
void InitFromV8Value(v8::Local<v8::Context> context,
|
|
|
|
v8::Local<v8::Value> value);
|
2013-06-27 00:33:44 +02:00
|
|
|
void InitUndefined();
|
|
|
|
void InitNull();
|
|
|
|
void InitBool(bool value);
|
|
|
|
void InitInt(int32 value);
|
|
|
|
void InitUInt(uint32 value);
|
|
|
|
void InitDouble(double value);
|
|
|
|
void InitDate(const CefTime& value);
|
|
|
|
void InitString(CefString& value);
|
2015-04-20 13:11:11 +02:00
|
|
|
void InitObject(v8::Local<v8::Value> value, CefTrackNode* tracker);
|
2013-06-27 00:33:44 +02:00
|
|
|
|
|
|
|
// Creates a new V8 value for the underlying value or returns the existing
|
|
|
|
// object handle.
|
2015-04-20 13:11:11 +02:00
|
|
|
v8::Local<v8::Value> GetV8Value(bool should_persist);
|
2013-06-27 00:33:44 +02:00
|
|
|
|
2014-11-12 20:25:15 +01:00
|
|
|
bool IsValid() override;
|
|
|
|
bool IsUndefined() override;
|
|
|
|
bool IsNull() override;
|
|
|
|
bool IsBool() override;
|
|
|
|
bool IsInt() override;
|
|
|
|
bool IsUInt() override;
|
|
|
|
bool IsDouble() override;
|
|
|
|
bool IsDate() override;
|
|
|
|
bool IsString() override;
|
|
|
|
bool IsObject() override;
|
|
|
|
bool IsArray() override;
|
2018-04-10 21:37:33 +02:00
|
|
|
bool IsArrayBuffer() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
bool IsFunction() override;
|
|
|
|
bool IsSame(CefRefPtr<CefV8Value> value) override;
|
|
|
|
bool GetBoolValue() override;
|
|
|
|
int32 GetIntValue() override;
|
|
|
|
uint32 GetUIntValue() override;
|
|
|
|
double GetDoubleValue() override;
|
|
|
|
CefTime GetDateValue() override;
|
|
|
|
CefString GetStringValue() override;
|
|
|
|
bool IsUserCreated() override;
|
|
|
|
bool HasException() override;
|
|
|
|
CefRefPtr<CefV8Exception> GetException() override;
|
|
|
|
bool ClearException() override;
|
|
|
|
bool WillRethrowExceptions() override;
|
|
|
|
bool SetRethrowExceptions(bool rethrow) override;
|
|
|
|
bool HasValue(const CefString& key) override;
|
|
|
|
bool HasValue(int index) override;
|
|
|
|
bool DeleteValue(const CefString& key) override;
|
|
|
|
bool DeleteValue(int index) override;
|
|
|
|
CefRefPtr<CefV8Value> GetValue(const CefString& key) override;
|
|
|
|
CefRefPtr<CefV8Value> GetValue(int index) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
bool SetValue(const CefString& key,
|
|
|
|
CefRefPtr<CefV8Value> value,
|
2014-11-12 20:25:15 +01:00
|
|
|
PropertyAttribute attribute) override;
|
|
|
|
bool SetValue(int index, CefRefPtr<CefV8Value> value) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
bool SetValue(const CefString& key,
|
|
|
|
AccessControl settings,
|
2014-11-12 20:25:15 +01:00
|
|
|
PropertyAttribute attribute) override;
|
|
|
|
bool GetKeys(std::vector<CefString>& keys) override;
|
2017-02-09 23:07:43 +01:00
|
|
|
bool SetUserData(CefRefPtr<CefBaseRefCounted> user_data) override;
|
|
|
|
CefRefPtr<CefBaseRefCounted> GetUserData() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
int GetExternallyAllocatedMemory() override;
|
|
|
|
int AdjustExternallyAllocatedMemory(int change_in_bytes) override;
|
|
|
|
int GetArrayLength() override;
|
2018-04-10 21:37:33 +02:00
|
|
|
CefRefPtr<CefV8ArrayBufferReleaseCallback> GetArrayBufferReleaseCallback()
|
|
|
|
override;
|
|
|
|
bool NeuterArrayBuffer() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
CefString GetFunctionName() override;
|
|
|
|
CefRefPtr<CefV8Handler> GetFunctionHandler() override;
|
|
|
|
CefRefPtr<CefV8Value> ExecuteFunction(
|
2012-04-03 03:34:16 +02:00
|
|
|
CefRefPtr<CefV8Value> object,
|
2014-11-12 20:25:15 +01:00
|
|
|
const CefV8ValueList& arguments) override;
|
|
|
|
CefRefPtr<CefV8Value> ExecuteFunctionWithContext(
|
2012-04-03 03:34:16 +02:00
|
|
|
CefRefPtr<CefV8Context> context,
|
|
|
|
CefRefPtr<CefV8Value> object,
|
2014-11-12 20:25:15 +01:00
|
|
|
const CefV8ValueList& arguments) override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2016-03-16 03:55:59 +01:00
|
|
|
private:
|
2012-04-03 03:34:16 +02:00
|
|
|
// Test for and record any exception.
|
2016-01-06 20:20:54 +01:00
|
|
|
bool HasCaught(v8::Local<v8::Context> context, v8::TryCatch& try_catch);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2012-10-29 22:46:02 +01:00
|
|
|
class Handle : public CefV8HandleBase {
|
2012-07-25 13:50:35 +02:00
|
|
|
public:
|
2014-02-05 21:35:45 +01:00
|
|
|
typedef v8::Local<v8::Value> handleType;
|
2012-07-25 13:50:35 +02:00
|
|
|
typedef v8::Persistent<v8::Value> persistentType;
|
|
|
|
|
2013-12-17 23:04:35 +01:00
|
|
|
Handle(v8::Isolate* isolate,
|
2015-04-20 13:11:11 +02:00
|
|
|
v8::Local<v8::Context> context,
|
2013-12-17 23:04:35 +01:00
|
|
|
handleType v,
|
2014-05-29 23:25:19 +02:00
|
|
|
CefTrackNode* tracker);
|
2012-07-25 13:50:35 +02:00
|
|
|
|
2014-05-29 23:25:19 +02:00
|
|
|
handleType GetNewV8Handle(bool should_persist);
|
2013-06-27 00:33:44 +02:00
|
|
|
|
2014-05-29 23:25:19 +02:00
|
|
|
persistentType& GetPersistentV8Handle();
|
|
|
|
|
|
|
|
void SetWeakIfNecessary();
|
2012-07-25 13:50:35 +02:00
|
|
|
|
2016-03-16 03:55:59 +01:00
|
|
|
private:
|
2014-11-12 20:25:15 +01:00
|
|
|
~Handle() override;
|
|
|
|
|
2012-07-25 13:50:35 +02:00
|
|
|
private:
|
2016-02-05 01:49:19 +01:00
|
|
|
// Callbacks for weak persistent reference destruction.
|
|
|
|
static void FirstWeakCallback(const v8::WeakCallbackInfo<Handle>& data);
|
|
|
|
static void SecondWeakCallback(const v8::WeakCallbackInfo<Handle>& data);
|
2014-05-29 23:25:19 +02:00
|
|
|
|
2012-07-25 13:50:35 +02:00
|
|
|
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.
|
|
|
|
CefTrackNode* tracker_;
|
|
|
|
|
2013-03-12 21:23:24 +01:00
|
|
|
// True if the handle needs to persist due to it being passed into V8.
|
|
|
|
bool should_persist_;
|
2012-10-30 21:49:43 +01:00
|
|
|
|
2014-05-29 23:25:19 +02:00
|
|
|
// True if the handle has been set as weak.
|
|
|
|
bool is_set_weak_;
|
|
|
|
|
2012-07-25 13:50:35 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(Handle);
|
|
|
|
};
|
2013-12-17 23:04:35 +01:00
|
|
|
|
|
|
|
v8::Isolate* isolate_;
|
2017-05-17 11:29:28 +02:00
|
|
|
|
2013-06-27 00:33:44 +02:00
|
|
|
enum {
|
|
|
|
TYPE_INVALID = 0,
|
|
|
|
TYPE_UNDEFINED,
|
|
|
|
TYPE_NULL,
|
|
|
|
TYPE_BOOL,
|
|
|
|
TYPE_INT,
|
|
|
|
TYPE_UINT,
|
|
|
|
TYPE_DOUBLE,
|
|
|
|
TYPE_DATE,
|
|
|
|
TYPE_STRING,
|
|
|
|
TYPE_OBJECT,
|
|
|
|
} type_;
|
|
|
|
|
|
|
|
union {
|
|
|
|
bool bool_value_;
|
|
|
|
int32 int_value_;
|
|
|
|
uint32 uint_value_;
|
|
|
|
double double_value_;
|
|
|
|
cef_time_t date_value_;
|
|
|
|
cef_string_t string_value_;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Used with Object, Function and Array types.
|
2012-07-25 13:50:35 +02:00
|
|
|
scoped_refptr<Handle> handle_;
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
CefRefPtr<CefV8Exception> last_exception_;
|
|
|
|
bool rethrow_exceptions_;
|
|
|
|
|
|
|
|
IMPLEMENT_REFCOUNTING(CefV8ValueImpl);
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefV8ValueImpl);
|
|
|
|
};
|
|
|
|
|
2012-07-25 13:50:35 +02:00
|
|
|
class CefV8StackTraceImpl : public CefV8StackTrace {
|
|
|
|
public:
|
2017-05-17 11:29:28 +02:00
|
|
|
CefV8StackTraceImpl(v8::Isolate* isolate, v8::Local<v8::StackTrace> handle);
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefV8StackTraceImpl() override;
|
2012-07-25 13:50:35 +02:00
|
|
|
|
2014-11-12 20:25:15 +01:00
|
|
|
bool IsValid() override;
|
|
|
|
int GetFrameCount() override;
|
|
|
|
CefRefPtr<CefV8StackFrame> GetFrame(int index) override;
|
2012-07-25 13:50:35 +02:00
|
|
|
|
2016-03-16 03:55:59 +01:00
|
|
|
private:
|
2017-05-17 11:29:28 +02:00
|
|
|
std::vector<CefRefPtr<CefV8StackFrame>> frames_;
|
2012-07-25 13:50:35 +02:00
|
|
|
|
|
|
|
IMPLEMENT_REFCOUNTING(CefV8StackTraceImpl);
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefV8StackTraceImpl);
|
|
|
|
};
|
|
|
|
|
|
|
|
class CefV8StackFrameImpl : public CefV8StackFrame {
|
|
|
|
public:
|
2017-05-17 11:29:28 +02:00
|
|
|
CefV8StackFrameImpl(v8::Isolate* isolate, v8::Local<v8::StackFrame> handle);
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefV8StackFrameImpl() override;
|
|
|
|
|
|
|
|
bool IsValid() override;
|
|
|
|
CefString GetScriptName() override;
|
|
|
|
CefString GetScriptNameOrSourceURL() override;
|
|
|
|
CefString GetFunctionName() override;
|
|
|
|
int GetLineNumber() override;
|
|
|
|
int GetColumn() override;
|
|
|
|
bool IsEval() override;
|
|
|
|
bool IsConstructor() override;
|
2012-07-25 13:50:35 +02:00
|
|
|
|
2016-03-16 03:55:59 +01:00
|
|
|
private:
|
2013-06-27 00:33:44 +02:00
|
|
|
CefString script_name_;
|
|
|
|
CefString script_name_or_source_url_;
|
|
|
|
CefString function_name_;
|
|
|
|
int line_number_;
|
|
|
|
int column_;
|
|
|
|
bool is_eval_;
|
|
|
|
bool is_constructor_;
|
2012-07-25 13:50:35 +02:00
|
|
|
|
|
|
|
IMPLEMENT_REFCOUNTING(CefV8StackFrameImpl);
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefV8StackFrameImpl);
|
|
|
|
};
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
#endif // CEF_LIBCEF_RENDERER_V8_IMPL_H_
|