当前位置: 首页>>代码示例>>C++>>正文


C++ PluginView::getNPObject方法代码示例

本文整理汇总了C++中PluginView::getNPObject方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginView::getNPObject方法的具体用法?C++ PluginView::getNPObject怎么用?C++ PluginView::getNPObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PluginView的用法示例。


在下文中一共展示了PluginView::getNPObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pluginScriptableObject

NPObject* PlatformBridge::pluginScriptableObject(Widget* widget)
{
#if USE(V8)
    if (!widget->isPluginView())
        return 0;

    PluginView* pluginView = static_cast<PluginView*>(widget);
    return pluginView->getNPObject();
#else
    return 0;
#endif
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:12,代码来源:PlatformBridge.cpp

示例2: createScriptInstanceForWidget

PassScriptInstance ScriptController::createScriptInstanceForWidget(Widget* widget)
{
    ASSERT(widget);

#if PLATFORM(CHROMIUM)
    if (widget->isFrameView())
        return 0;

    NPObject* npObject = ChromiumBridge::pluginScriptableObject(widget);
    if (!npObject)
        return 0;

#elif PLATFORM(ANDROID)
    if (!widget->isPluginView())
        return 0;

    PluginView* pluginView = static_cast<PluginView*>(widget);
    NPObject* npObject = pluginView->getNPObject();
    if (!npObject)
        return 0;
#endif

    // Frame Memory Management for NPObjects
    // -------------------------------------
    // NPObjects are treated differently than other objects wrapped by JS.
    // NPObjects can be created either by the browser (e.g. the main
    // window object) or by the plugin (the main plugin object
    // for a HTMLEmbedElement). Further, unlike most DOM Objects, the frame
    // is especially careful to ensure NPObjects terminate at frame teardown because
    // if a plugin leaks a reference, it could leak its objects (or the browser's objects).
    //
    // The Frame maintains a list of plugin objects (m_pluginObjects)
    // which it can use to quickly find the wrapped embed object.
    //
    // Inside the NPRuntime, we've added a few methods for registering
    // wrapped NPObjects. The purpose of the registration is because
    // javascript garbage collection is non-deterministic, yet we need to
    // be able to tear down the plugin objects immediately. When an object
    // is registered, javascript can use it. When the object is destroyed,
    // or when the object's "owning" object is destroyed, the object will
    // be un-registered, and the javascript engine must not use it.
    //
    // Inside the javascript engine, the engine can keep a reference to the
    // NPObject as part of its wrapper. However, before accessing the object
    // it must consult the _NPN_Registry.

    v8::Local<v8::Object> wrapper = createV8ObjectForNPObject(npObject, 0);

    // Track the plugin object. We've been given a reference to the object.
    m_pluginObjects.set(widget, npObject);

    return V8ScriptInstance::create(wrapper);
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:53,代码来源:ScriptController.cpp


注:本文中的PluginView::getNPObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。