Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/libraries/source/spidermonkey/include-win32-debug/js/Debug.h
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- | ||||
* vim: set ts=8 sts=4 et sw=4 tw=99: | * vim: set ts=8 sts=2 et sw=2 tw=80: | ||||
* This Source Code Form is subject to the terms of the Mozilla Public | * This Source Code Form is subject to the terms of the Mozilla Public | ||||
* License, v. 2.0. If a copy of the MPL was not distributed with this | * License, v. 2.0. If a copy of the MPL was not distributed with this | ||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||||
// Interfaces by which the embedding can interact with the Debugger API. | // Interfaces by which the embedding can interact with the Debugger API. | ||||
#ifndef js_Debug_h | #ifndef js_Debug_h | ||||
#define js_Debug_h | #define js_Debug_h | ||||
Show All 11 Lines | |||||
namespace js { | namespace js { | ||||
class Debugger; | class Debugger; | ||||
} // namespace js | } // namespace js | ||||
namespace JS { | namespace JS { | ||||
namespace dbg { | namespace dbg { | ||||
// [SMDOC] Debugger builder API | |||||
// | |||||
// Helping embedding code build objects for Debugger | // Helping embedding code build objects for Debugger | ||||
// ------------------------------------------------- | // ------------------------------------------------- | ||||
// | // | ||||
// Some Debugger API features lean on the embedding application to construct | // Some Debugger API features lean on the embedding application to construct | ||||
// their result values. For example, Debugger.Frame.prototype.scriptEntryReason | // their result values. For example, Debugger.Frame.prototype.scriptEntryReason | ||||
// calls hooks provided by the embedding to construct values explaining why it | // calls hooks provided by the embedding to construct values explaining why it | ||||
// invoked JavaScript; if F is a frame called from a mouse click event handler, | // invoked JavaScript; if F is a frame called from a mouse click event handler, | ||||
// F.scriptEntryReason would return an object of the form: | // F.scriptEntryReason would return an object of the form: | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
// the object shown above, given a Builder passed to it by Debugger: | // the object shown above, given a Builder passed to it by Debugger: | ||||
// | // | ||||
// bool | // bool | ||||
// MyScriptEntryReason::explain(JSContext* cx, | // MyScriptEntryReason::explain(JSContext* cx, | ||||
// Builder& builder, | // Builder& builder, | ||||
// Builder::Object& result) | // Builder::Object& result) | ||||
// { | // { | ||||
// JSObject* eventObject = ... obtain debuggee event object somehow ...; | // JSObject* eventObject = ... obtain debuggee event object somehow ...; | ||||
// if (!eventObject) | // if (!eventObject) { | ||||
// return false; | // return false; | ||||
// } | |||||
// result = builder.newObject(cx); | // result = builder.newObject(cx); | ||||
// return result && | // return result && | ||||
// result.defineProperty(cx, "eventType", | // result.defineProperty(cx, "eventType", | ||||
// SafelyFetchType(eventObject)) && | // SafelyFetchType(eventObject)) && | ||||
// result.defineProperty(cx, "event", eventObject); | // result.defineProperty(cx, "event", eventObject); | ||||
// } | // } | ||||
// | // | ||||
// | // | ||||
Show All 39 Lines | protected: | ||||
protected: | protected: | ||||
// The Builder to which this trusted thing belongs. | // The Builder to which this trusted thing belongs. | ||||
Builder& owner; | Builder& owner; | ||||
// A rooted reference to our value. | // A rooted reference to our value. | ||||
PersistentRooted<T> value; | PersistentRooted<T> value; | ||||
BuiltThing(JSContext* cx, Builder& owner_, | BuiltThing(JSContext* cx, Builder& owner_, | ||||
T value_ = GCPolicy<T>::initial()) | T value_ = SafelyInitialized<T>()) | ||||
: owner(owner_), value(cx, value_) { | : owner(owner_), value(cx, value_) { | ||||
owner.assertBuilt(value_); | owner.assertBuilt(value_); | ||||
} | } | ||||
// Forward some things from our owner, for convenience. | // Forward some things from our owner, for convenience. | ||||
js::Debugger* debugger() const { return owner.debugger; } | js::Debugger* debugger() const { return owner.debugger; } | ||||
JSObject* debuggerObject() const { return owner.debuggerObject; } | JSObject* debuggerObject() const { return owner.debuggerObject; } | ||||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | JS_PUBLIC_API bool FireOnGarbageCollectionHook( | ||||
JSContext* cx, GarbageCollectionEvent::Ptr&& data); | JSContext* cx, GarbageCollectionEvent::Ptr&& data); | ||||
// Return true if the given value is a Debugger object, false otherwise. | // Return true if the given value is a Debugger object, false otherwise. | ||||
JS_PUBLIC_API bool IsDebugger(JSObject& obj); | JS_PUBLIC_API bool IsDebugger(JSObject& obj); | ||||
// Append each of the debuggee global objects observed by the Debugger object | // Append each of the debuggee global objects observed by the Debugger object | ||||
// |dbgObj| to |vector|. Returns true on success, false on failure. | // |dbgObj| to |vector|. Returns true on success, false on failure. | ||||
JS_PUBLIC_API bool GetDebuggeeGlobals(JSContext* cx, JSObject& dbgObj, | JS_PUBLIC_API bool GetDebuggeeGlobals(JSContext* cx, JSObject& dbgObj, | ||||
AutoObjectVector& vector); | MutableHandleObjectVector vector); | ||||
// Hooks for reporting where JavaScript execution began. | // Hooks for reporting where JavaScript execution began. | ||||
// | // | ||||
// Our performance tools would like to be able to label blocks of JavaScript | // Our performance tools would like to be able to label blocks of JavaScript | ||||
// execution with the function name and source location where execution began: | // execution with the function name and source location where execution began: | ||||
// the event handler, the callback, etc. | // the event handler, the callback, etc. | ||||
// | // | ||||
// Construct an instance of this class on the stack, providing a JSContext | // Construct an instance of this class on the stack, providing a JSContext | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator