本文整理汇总了C++中wtf::String::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ String::isNull方法的具体用法?C++ String::isNull怎么用?C++ String::isNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wtf::String
的用法示例。
在下文中一共展示了String::isNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: supportsType
MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const WTF::String& type, const WTF::String& codecs, const KURL& url)
{
bool isRTSP = url.protocolIs("rtsp");
if (!isRTSP && (type.isNull() || type.isEmpty())) {
LOG(Media, "MediaPlayer does not support type; type is null or empty.");
return MediaPlayer::IsNotSupported;
}
// spec says we should not return "probably" if the codecs string is empty
if (isRTSP || PlatformPlayer::mimeTypeSupported(type.ascii().data())) {
LOG(Media, "MediaPlayer supports type %s.", isRTSP ? "rtsp" : type.ascii().data());
return codecs.isEmpty() ? MediaPlayer::MayBeSupported : MediaPlayer::IsSupported;
}
LOG(Media, "MediaPlayer does not support type %s.", type.ascii().data());
return MediaPlayer::IsNotSupported;
}
示例2: string
static inline std::string fromWTFString(const WTF::String& wtf_string) {
if (wtf_string.isNull()) return std::string();
WTF::CString cstring = wtf_string.ascii();
return std::string(cstring.data(), cstring.length());
}
示例3: updateHistoryItem
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 WTF::String urlString = WebFrame::convertIDNToUnicode(item->url());
jstring urlStr = NULL;
if (!urlString.isNull())
urlStr = wtfStringToJstring(env, urlString);
const WTF::String originalUrlString = WebFrame::convertIDNToUnicode(item->originalURL());
jstring originalUrlStr = NULL;
if (!originalUrlString.isNull())
originalUrlStr = wtfStringToJstring(env, originalUrlString);
const WTF::String& titleString = item->title();
jstring titleStr = NULL;
if (!titleString.isNull())
titleStr = wtfStringToJstring(env, titleString);
// 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;
WTF::String url = item->urlString();
if (item->url().hasFragmentIdentifier()) {
int refIndex = url.reverseFind('#');
url = url.substring(0, refIndex);
}
// FIXME: This method should not be used from outside WebCore and will be removed.
// http://trac.webkit.org/changeset/81484
WebCore::Image* icon = WebCore::iconDatabase().synchronousIconForPageURL(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);
}