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


C++ AutoJObject类代码示例

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


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

示例1: createJavaPlayerIfNeeded

    void createJavaPlayerIfNeeded()
    {
        // Check if we have been already created.
        if (m_glue->m_javaProxy)
            return;

        JNIEnv* env = JSC::Bindings::getJNIEnv();
        if (!env)
            return;

        jclass clazz = env->FindClass(g_ProxyJavaClassAudio);

        if (!clazz)
            return;

        FrameView* frameView = m_player->mediaPlayerClient()->mediaPlayerOwningDocument()->view();
        if (!frameView)
            return;
        AutoJObject javaObject = WebViewCore::getWebViewCore(frameView)->getJavaObject();
        if (!javaObject.get())
            return;

        jobject obj = 0;

        // Get the HTML5Audio instance
        obj = env->NewObject(clazz, m_glue->m_newInstance, javaObject.get(), this);
        m_glue->m_javaProxy = env->NewGlobalRef(obj);

        // Clean up.
        if (obj)
            env->DeleteLocalRef(obj);
        env->DeleteLocalRef(clazz);
        checkException(env);
    }
开发者ID:wufuyue,项目名称:TCL_S820,代码行数:34,代码来源:MediaPlayerPrivateAndroid.cpp

示例2: AddItem

void WebHistory::AddItem(const AutoJObject& list, WebCore::HistoryItem* item)
{
    LOG_ASSERT(item, "newItem must take a valid HistoryItem!");
    // Item already added. Should only happen when we are inflating the list.
    if (item->bridge() || !list.get())
        return;

    JNIEnv* env = list.env();
    // Allocate a blank WebHistoryItem
    jclass clazz = env->FindClass("android/webkit/WebHistoryItem");
    jobject newItem = env->NewObject(clazz, gWebHistoryItem.mInit);

    // Create the bridge, make it active, and attach it to the item.
    WebHistoryItem* bridge = new WebHistoryItem(env, newItem, item);
    bridge->setActive();
    item->setBridge(bridge);

    // Update the history item which will flatten the data and call update on
    // the java item.
    bridge->updateHistoryItem(item);

    // Add it to the list.
    env->CallVoidMethod(list.get(), gWebBackForwardList.mAddHistoryItem, newItem);

    // Delete our local reference.
    env->DeleteLocalRef(newItem);
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:27,代码来源:WebHistory.cpp

示例3: javaObject

void
JavaBridge::setSharedTimer(long long timemillis)
{
    JNIEnv* env = JSC::Bindings::getJNIEnv();
    AutoJObject obj = javaObject(env);
    if (!obj.get())
        return;
    env->CallVoidMethod(obj.get(), mSetSharedTimer, timemillis);
}
开发者ID:OmarBizreh,项目名称:Sliding_XZ,代码行数:9,代码来源:JavaBridge.cpp

示例4: setDrawingModel

bool PluginWidgetAndroid::setDrawingModel(ANPDrawingModel model) {

    if (model == kOpenGL_ANPDrawingModel && m_layer == 0) {
        jobject webview = m_core->getWebViewJavaObject();
        AutoJObject webViewCore = m_core->getJavaObject();
        m_layer = new WebCore::MediaLayer(webview, webViewCore.get());
    }
    else if (model != kOpenGL_ANPDrawingModel && m_layer != 0) {
        m_layer->unref();
        m_layer = 0;
    }

    if (m_drawingModel != model) {
        // Trigger layer computation in RenderLayerCompositor
        m_pluginView->getElement()->setNeedsStyleRecalc(SyntheticStyleChange);
    }

    m_drawingModel = model;
    return true;
}
开发者ID:AndDiSa,项目名称:platform_external_webkit,代码行数:20,代码来源:PluginWidgetAndroid.cpp

示例5: UpdateHistoryIndex

void WebHistory::UpdateHistoryIndex(const AutoJObject& list, int newIndex)
{
    if (list.get())
        list.env()->CallVoidMethod(list.get(), gWebBackForwardList.mSetCurrentIndex, newIndex);
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:5,代码来源:WebHistory.cpp

示例6: RemoveItem

void WebHistory::RemoveItem(const AutoJObject& list, int index)
{
    if (list.get())
        list.env()->CallVoidMethod(list.get(), gWebBackForwardList.mRemoveHistoryItem, index);
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:5,代码来源:WebHistory.cpp

示例7: LOGW

void WebHistoryItem::updateHistoryItem(WebCore::HistoryItem* item) {
    // Do not want to update during inflation.
    if (!m_active)
        return;
    WebHistoryItem* webItem = this;
    // Now we need to update the top-most WebHistoryItem based on the top-most
    // HistoryItem.
    if (m_parent) {
        webItem = m_parent.get();
        if (webItem->hasOneRef()) {
            // if the parent only has one ref, it is from this WebHistoryItem.
            // This means that the matching WebCore::HistoryItem has been freed.
            // This can happen during clear().
            LOGW("Can't updateHistoryItem as the top HistoryItem is gone");
            return;
        }
        while (webItem->parent())
            webItem = webItem->parent();
        item = webItem->historyItem();
        if (!item) {
            // If a HistoryItem only exists for page cache, it is possible that
            // the parent HistoryItem destroyed before the child HistoryItem. If
            // it happens, skip updating.
            LOGW("Can't updateHistoryItem as the top HistoryItem is gone");
            return;
        }
    }
    JNIEnv* env = JSC::Bindings::getJNIEnv();
    if (!env)
        return;

    // Don't do anything if the item has been gc'd already
    AutoJObject realItem = getRealObject(env, webItem->m_object);
    if (!realItem.get())
        return;

    const WebCore::String& urlString = item->urlString();
    jstring urlStr = NULL;
    if (!urlString.isNull())
        urlStr = env->NewString((unsigned short*)urlString.characters(), urlString.length());
    const WebCore::String& originalUrlString = item->originalURLString();
    jstring originalUrlStr = NULL;
    if (!originalUrlString.isNull()) {
    	originalUrlStr = env->NewString(
                (unsigned short*) originalUrlString.characters(), 
                originalUrlString.length());
    }
    const WebCore::String& titleString = item->title();
    jstring titleStr = NULL;
    if (!titleString.isNull())
        titleStr = env->NewString((unsigned short*)titleString.characters(), titleString.length());

    // Try to get the favicon from the history item. For some pages like Grand
    // Prix, there are history items with anchors. If the icon fails for the
    // item, try to get the icon using the url without the ref.
    jobject favicon = NULL;
    WebCore::String url = item->urlString();
    if (item->url().hasFragmentIdentifier()) {
        int refIndex = url.reverseFind('#');
        url = url.substring(0, refIndex);
    }
    WebCore::Image* icon = WebCore::iconDatabase()->iconForPageURL(url,
            WebCore::IntSize(16, 16));

    if (icon)
        favicon = webcoreImageToJavaBitmap(env, icon);

    WTF::Vector<char> data;
    jbyteArray array = WebHistory::Flatten(env, data, item);
    env->CallVoidMethod(realItem.get(), gWebHistoryItem.mUpdate, urlStr,
            originalUrlStr, titleStr, favicon, array);
    env->DeleteLocalRef(urlStr);
    env->DeleteLocalRef(originalUrlStr);
    env->DeleteLocalRef(titleStr);
    if (favicon)
        env->DeleteLocalRef(favicon);
    env->DeleteLocalRef(array);
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:78,代码来源:WebHistory.cpp


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