本文整理汇总了C++中wtf::RefPtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ RefPtr::get方法的具体用法?C++ RefPtr::get怎么用?C++ RefPtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wtf::RefPtr
的用法示例。
在下文中一共展示了RefPtr::get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSamplerNode
BaseSamplerNode* SamplerApollo::getSamplerNode(uint64_t identifier)
{
// cache the result
if (m_cachedSearchNode.get() && m_cachedSearchNode->identifier() == identifier)
return m_cachedSearchNode.get();
WTF::RefPtr<BaseSamplerNode> node = m_liveNodesByIdentifier.get(identifier);
if (!node.get())
node = m_deadNodesByIdentifier.get(identifier);
m_cachedSearchNode = node.get();
return node.get();
}
示例2: ASSERT
WTF::PassRefPtr<WebDebugListenerImpl> WebDebugListenerImpl::getInstance()
{
static bool preventSecondTry = false;
static WTF::RefPtr<WebDebugListenerImpl> htmlDebugListener;
if (!preventSecondTry && !htmlDebugListener.get()) {
preventSecondTry = true;
ASSERT(WebKitApollo::g_HostFunctions->getWebDebugListener);
WebDebugListener * debugger = WebKitApollo::g_HostFunctions->getWebDebugListener();
if (debugger) {
// debugger might be 0 when it's not activated;
htmlDebugListener = new WebDebugListenerImpl( debugger );
}
}
return htmlDebugListener.get();
}
示例3: core
WebCore::HistoryItem* WebKit::core(WebKitWebHistoryItem* webHistoryItem)
{
g_return_val_if_fail(WEBKIT_IS_WEB_HISTORY_ITEM(webHistoryItem), NULL);
WebKitWebHistoryItemPrivate* priv = webHistoryItem->priv;
WTF::RefPtr<WebCore::HistoryItem> historyItem = priv->historyItem;
return historyItem ? historyItem.get() : 0;
}
示例4: GetAsRange
WebDOMRange* wxWebKitSelection::GetAsRange()
{
if (m_selection) {
WTF::RefPtr<WebCore::Range> range = m_selection->toNormalizedRange();
// keep it alive until it reaches wxWebKitDOMRange, which takes ownership
if (range) {
range->ref();
return new WebDOMRange(range.get());
}
}
return 0;
}
示例5: canRequest
bool SecurityOrigin::canRequest(const KUrl& url) const
{
if (isUnique())
return false;
WTF::RefPtr<SecurityOrigin> targetOrigin = SecurityOrigin::create(url);
if (targetOrigin->isUnique())
return false;
// We call isSameSchemeHostPort here instead of canAccess because we want
// to ignore document.domain effects.
if (isSameSchemeHostPort(targetOrigin.get()))
return true;
return false;
}
示例6: unit_test
static void unit_test()
{
LOGD("Entering history unit test!");
const char* test1 = new char[0];
WTF::RefPtr<WebCore::HistoryItem> item = WebCore::HistoryItem::create();
WebCore::HistoryItem* testItem = item.get();
testItem->setBridge(new WebHistoryItem(0));
LOG_ASSERT(!read_item_recursive(testItem, &test1, 0), "0 length array should fail!");
delete[] test1;
const char* test2 = new char[2];
LOG_ASSERT(!read_item_recursive(testItem, &test2, 2), "Small array should fail!");
delete[] test2;
LOG_ASSERT(!read_item_recursive(testItem, NULL, HISTORY_MIN_SIZE), "Null data should fail!");
// Original Url
char* test3 = new char[HISTORY_MIN_SIZE];
const char* ptr = (const char*)test3;
memset(test3, 0, HISTORY_MIN_SIZE);
*(int*)test3 = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 length originalUrl should fail!");
// Url
int offset = 4;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(int*)(test3 + offset) = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 length url should fail!");
// Title
offset += 4;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(int*)(test3 + offset) = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 length title should fail!");
// Form content type
offset += 4;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(int*)(test3 + offset) = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 length contentType should fail!");
// Form data
offset += 4;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(int*)(test3 + offset) = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 length form data should fail!");
// Target
offset += 4;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(int*)(test3 + offset) = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 length target should fail!");
offset += 4; // Scale
// Document state
offset += 4;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(int*)(test3 + offset) = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 length document state should fail!");
// Is target item
offset += 1;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(char*)(test3 + offset) = '!';
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "IsTargetItem should fail with ! as the value!");
// Child count
offset += 4;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(int*)(test3 + offset) = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 kids should fail!");
offset = 36;
// Test document state
delete[] test3;
test3 = new char[HISTORY_MIN_SIZE + sizeof(unsigned)];
memset(test3, 0, HISTORY_MIN_SIZE + sizeof(unsigned));
ptr = (const char*)test3;
*(int*)(test3 + offset) = 1;
*(int*)(test3 + offset + 4) = 20;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE + sizeof(unsigned)), "1 20 length document state string should fail!");
delete[] test3;
test3 = new char[HISTORY_MIN_SIZE + 2 * sizeof(unsigned)];
memset(test3, 0, HISTORY_MIN_SIZE + 2 * sizeof(unsigned));
ptr = (const char*)test3;
*(int*)(test3 + offset) = 2;
*(int*)(test3 + offset + 4) = 0;
*(int*)(test3 + offset + 8) = 20;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE + 2 * sizeof(unsigned) ), "2 20 length document state string should fail!");
delete[] test3;
}
示例7: readItemRecursive
static bool readItemRecursive(WebCore::HistoryItem* newItem,
const char** pData, int length)
{
if (!pData || length < HISTORY_MIN_SIZE) {
ALOGW("readItemRecursive() bad params; pData=%p length=%d", pData, length);
return false;
}
const char* data = *pData;
const char* end = data + length;
String content;
// Read the original url
if (readString(data, end, content, "Original url"))
newItem->setOriginalURLString(content);
else
return false;
// Read the url
if (readString(data, end, content, "Url"))
newItem->setURLString(content);
else
return false;
// Read the title
if (readString(data, end, content, "Title"))
newItem->setTitle(content);
else
return false;
// Generate a new ResourceRequest object for populating form information.
// Read the form content type
WTF::String formContentType;
if (!readString(data, end, formContentType, "Content type"))
return false;
// Read the form data size
unsigned formDataSize;
if (!readUnsigned(data, end, formDataSize, "Form data size"))
return false;
// Read the form data
WTF::RefPtr<WebCore::FormData> formData;
if (formDataSize) {
ALOGV("Reading Form data %d %.*s", formDataSize, formDataSize, data);
if ((end < data) || ((size_t)(end - data) < formDataSize)) {
ALOGW("\tNot enough data to read form data; returning");
return false;
}
formData = WebCore::FormData::create(data, formDataSize);
data += formDataSize;
// Read the identifier
int64_t id;
if (!readInt64(data, end, id, "Form id"))
return false;
if (id)
formData->setIdentifier(id);
}
// Set up the form info
if (formData != NULL) {
WebCore::ResourceRequest r;
r.setHTTPMethod("POST");
r.setHTTPContentType(formContentType);
r.setHTTPBody(formData);
newItem->setFormInfoFromRequest(r);
}
// Read the target
if (readString(data, end, content, "Target"))
newItem->setTarget(content);
else
return false;
AndroidWebHistoryBridge* bridge = newItem->bridge();
ALOG_ASSERT(bridge, "There should be a bridge object during inflate");
// Read the screen scale
float fValue;
if (readFloat(data, end, fValue, "Screen scale"))
bridge->setScale(fValue);
else
return false;
// Read the text wrap scale
if (readFloat(data, end, fValue, "Text wrap scale"))
bridge->setTextWrapScale(fValue);
else
return false;
// Read scroll position.
int scrollX;
if (!readInt(data, end, scrollX, "Scroll pos x"))
return false;
int scrollY;
if (!readInt(data, end, scrollY, "Scroll pos y"))
return false;
newItem->setScrollPoint(IntPoint(scrollX, scrollY));
// Read the document state
//.........这里部分代码省略.........