本文整理汇总了C++中wtf::PassRefPtr类的典型用法代码示例。如果您正苦于以下问题:C++ PassRefPtr类的具体用法?C++ PassRefPtr怎么用?C++ PassRefPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PassRefPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: registerJSCell
void SamplerApollo::registerJSCell(JSGlobalObject* globalObject, JSCell* cell, size_t size)
{
WTF::PassRefPtr<SamplerJSCellNode> constructorNode = m_constructorNode.release();
if (UNLIKELY(!samplingNow))
return;
uint64_t globalObjectIdentifier = 0;
if (globalObject) {
BaseSamplerNode* globalObjectSample = getSamplerNodeFor(globalObject);
if (globalObjectSample)
globalObjectIdentifier = globalObjectSample->identifier();
}
PassRefPtr<SamplerJSCellNode> samplerNodeRef = adoptRef(new SamplerJSCellNode(globalObjectIdentifier, cell, size));
SamplerJSCellNode *samplerNode = samplerNodeRef.get();
if (registerNode(samplerNodeRef)) {
// cannot check the type because we are called directly from operator new
if (constructorNode.get() /* && cell->isObject() */) {
JSCell * const cell = constructorNode->impl();
// we don't want to make standard objects to show like Functions
// Internal construct for String,Boolean,... inherits directly InternalFunctions
if (! (cell && cell->getObject() && cell->getObject()->inherits(&InternalFunction::info) && !cell->getObject()->inherits(&JSFunction::info)) ) {
// try to set the name from the function
samplerNode->setObjectType(constructorNode->name());
}
}
}
}
示例2: runOpenPanel
void ChromeClientBlackBerry::runOpenPanel(WebCore::Frame*, WTF::PassRefPtr<WebCore::FileChooser> chooser)
{
SharedArray<WebString> initialFiles;
unsigned int initialFileSize = chooser->filenames().size();
if (initialFileSize > 0)
initialFiles.reset(new WebString[initialFileSize]);
for (unsigned i = 0; i < initialFileSize; ++i)
initialFiles[i] = chooser->filenames()[i];
SharedArray<WebString> chosenFiles;
unsigned int chosenFileSize;
{
PageGroupLoadDeferrer deferrer(m_webPage->d->m_page, true);
TimerBase::fireTimersInNestedEventLoop();
if (!m_webPage->client()->chooseFilenames(chooser->allowsMultipleFiles(), chooser->acceptTypes(), initialFiles, initialFileSize, chosenFiles, chosenFileSize))
return;
}
Vector<WTF::String> files(chosenFileSize);
for (unsigned i = 0; i < chosenFileSize; ++i)
files[i] = chosenFiles[i];
chooser->chooseFiles(files);
}
示例3: createWindow
Page* ChromeClientAndroid::createWindow(Frame* frame, const FrameLoadRequest&,
const WindowFeatures& features)
{
ASSERT(frame);
#ifdef ANDROID_MULTIPLE_WINDOWS
if (frame->settings() && !(frame->settings()->supportMultipleWindows()))
// If the client doesn't support multiple windows, just return the current page
return frame->page();
#endif
WTF::PassRefPtr<WebCore::Screen> screen = WebCore::Screen::create(frame);
bool dialog = features.dialog || !features.resizable
|| (features.heightSet && features.height < screen.get()->height()
&& features.widthSet && features.width < screen.get()->width())
|| (!features.menuBarVisible && !features.statusBarVisible
&& !features.toolBarVisible && !features.locationBarVisible
&& !features.scrollbarsVisible);
// fullscreen definitely means no dialog
if (features.fullscreen)
dialog = false;
WebCore::Frame* newFrame = m_webFrame->createWindow(dialog,
frame->script()->processingUserGesture());
if (newFrame) {
WebCore::Page* page = newFrame->page();
page->setGroupName(frame->page()->groupName());
return page;
}
return NULL;
}
示例4: swapPlugin
//SanJose++
void swapPlugin(RenderWidget* renderer, bool isFocused) {
//SanJose--
typedef FrameLoaderClientAndroid FLCA;
FLCA* client = static_cast<FLCA*>(m_parent->loader()->client());
client->enableOnDemandPlugins();
WTF::PassRefPtr<PluginView> prpWidget =
PluginView::create(m_parent.get(),
m_size,
m_element,
m_url,
m_paramNames,
m_paramValues,
m_mimeType,
m_loadManually);
RefPtr<Widget> myProtector(this);
//SanJose++
//When on demand is on and flash is loaded by clicking the PluginToggleWidget, sroll deost work
//on flash objects.
//ex: aftonbladet.se. This happens because when the flash is selected for download, ALL flash
//objects are set to be focused through the following API. None of flash objects is set to be
//focused (due to no selection) when "always on" is enabled, in which case scroll has no problem.
//FIX: Only set focus for the flash object user explicitly selected when flash is downloaded manually.
if (isFocused) {
prpWidget->focusPluginElement();
}
//SanJose--
renderer->setWidget(prpWidget);
}
示例5: requestCheckingOfString
void EditorClientImpl::requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest> request)
{
if (m_webView->spellCheckClient()) {
const String& text = request->data().text();
const Vector<uint32_t>& markers = request->data().markers();
const Vector<unsigned>& markerOffsets = request->data().offsets();
m_webView->spellCheckClient()->requestCheckingOfText(text, markers, markerOffsets, new WebTextCheckingCompletionImpl(request));
}
}
示例6: loadResourceIntoArray
WTF::PassRefPtr<Image> Image::loadPlatformResource(const char* name)
{
Vector<char> array = loadResourceIntoArray(name);
WTF::PassRefPtr<BitmapImage> image = BitmapImage::create();
RefPtr<SharedBuffer> buffer = SharedBuffer::create(array.data(), array.size());
image->setData(buffer, true);
return image;
}
示例7: requestCheckingOfString
void EditorClientImpl::requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest> request)
{
if (m_webView->spellCheckClient()) {
String text = request->text();
m_webView->spellCheckClient()->requestCheckingOfText(text, new WebTextCheckingCompletionImpl(request));
}
}
示例8: source
JSC::EvalExecutable *QScriptProgramPrivate::executable(JSC::ExecState *exec,
QScriptEnginePrivate *eng)
{
if (_executable) {
if (eng == engine)
return _executable.get();
_executable = 0;
}
WTF::PassRefPtr<QScript::UStringSourceProviderWithFeedback> provider
= QScript::UStringSourceProviderWithFeedback::create(sourceCode, fileName, firstLineNumber, eng);
sourceId = provider->asID();
JSC::SourceCode source(provider, firstLineNumber); //after construction of SourceCode provider variable will be null.
_executable = JSC::EvalExecutable::create(exec, source);
engine = eng;
isCompiled = false;
return _executable.get();
}
示例9: getData
JSValue JSClipboard::getData(ExecState* exec, const ArgList& args)
{
// FIXME: It does not match the rest of the JS bindings to throw on invalid number of arguments.
if (args.size() != 1)
return throwError(exec, SyntaxError, "getData: Invalid number of arguments");
Clipboard* const clipboard = impl();
bool success;
String const mimeType = ustringToString(args.at(0).toString(exec));
if (mimeType == ClipboardApolloHelper::BITMAP_TYPE) {
WTF::PassRefPtr<Node> result = clipboard->getDataNode(mimeType, success);
return success ? toJS(exec, result.get()) : jsUndefined();
} else {
JSValue const result = clipboard->getDataValue(mimeType, success);
return success ? result : jsUndefined();
}
}
示例10: shim
JSC::EvalExecutable *QScriptProgramPrivate::executable(JSC::ExecState *exec,
QScriptEnginePrivate *eng)
{
if (_executable) {
if (eng == engine)
return _executable.get();
// "Migrating" to another engine; clean up old state
QScript::APIShim shim(engine);
_executable.clear();
engine->unregisterScriptProgram(this);
}
WTF::PassRefPtr<QScript::UStringSourceProviderWithFeedback> provider
= QScript::UStringSourceProviderWithFeedback::create(sourceCode, fileName, firstLineNumber, eng);
sourceId = provider->asID();
JSC::SourceCode source(provider, firstLineNumber); //after construction of SourceCode provider variable will be null.
_executable = JSC::EvalExecutable::create(exec, source);
engine = eng;
engine->registerScriptProgram(this);
isCompiled = false;
return _executable.get();
}
示例11: registerNode
bool SamplerApollo::registerNode(WTF::PassRefPtr<BaseSamplerNode> node)
{
if (UNLIKELY(!samplingNow))
return false;
// check if the object was allocated earlier or if maybe the old object
// didn't trigger deallocation
ASSERT(getSamplerNodeFor(node->ptr()) == 0);
const uint64_t identifier = samplerDidAllocate(node.get());
if (identifier) {
node->setIdentifier(identifier);
m_liveNodes.add(node->ptr(), node.get());
m_liveNodesByIdentifier.add(node->identifier(), node.get());
// the references from liveNodes maps + pass ref ptr
ASSERT(node->refCount() == 3);
return true;
}
return false;
}
示例12:
WebSecurityOrigin::WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>& origin)
: m_private(static_cast<WebSecurityOriginPrivate*>(origin.releaseRef()))
{
}
示例13: read_item_recursive
static bool read_item_recursive(WebCore::HistoryItem* newItem,
const char** pData, int length)
{
if (!pData || length < HISTORY_MIN_SIZE)
return false;
const WebCore::TextEncoding& e = WebCore::UTF8Encoding();
const char* data = *pData;
const char* end = data + length;
int sizeofUnsigned = (int)sizeof(unsigned);
// Read the original url
// Read the expected length of the string.
int l;
memcpy(&l, data, sizeofUnsigned);
// Increment data pointer by the size of an unsigned int.
data += sizeofUnsigned;
if (l) {
LOGV("Original url %d %.*s", l, l, data);
// If we have a length, check if that length exceeds the data length
// and return null if there is not enough data.
if (data + l < end)
newItem->setOriginalURLString(e.decode(data, l));
else
return false;
// Increment the data pointer by the length of the string.
data += l;
}
// Check if we have enough data left to continue.
if (end - data < sizeofUnsigned)
return false;
// Read the url
memcpy(&l, data, sizeofUnsigned);
data += sizeofUnsigned;
if (l) {
LOGV("Url %d %.*s", l, l, data);
if (data + l < end)
newItem->setURLString(e.decode(data, l));
else
return false;
data += l;
}
if (end - data < sizeofUnsigned)
return false;
// Read the title
memcpy(&l, data, sizeofUnsigned);
data += sizeofUnsigned;
if (l) {
LOGV("Title %d %.*s", l, l, data);
if (data + l < end)
newItem->setTitle(e.decode(data, l));
else
return false;
data += l;
}
if (end - data < sizeofUnsigned)
return false;
// Generate a new ResourceRequest object for populating form information.
WebCore::String formContentType;
WTF::PassRefPtr<WebCore::FormData> formData = NULL;
// Read the form content type
memcpy(&l, data, sizeofUnsigned);
data += sizeofUnsigned;
if (l) {
LOGV("Content type %d %.*s", l, l, data);
if (data + l < end)
formContentType = e.decode(data, l);
else
return false;
data += l;
}
if (end - data < sizeofUnsigned)
return false;
// Read the form data
memcpy(&l, data, sizeofUnsigned);
data += sizeofUnsigned;
if (l) {
LOGV("Form data %d %.*s", l, l, data);
if (data + l < end)
formData = WebCore::FormData::create(data, l);
else
return false;
data += l;
// Read the identifier
{
int64_t id;
int size = (int)sizeof(int64_t);
memcpy(&id, data, size);
data += size;
if (id)
formData->setIdentifier(id);
}
}
if (end - data < sizeofUnsigned)
return false;
//.........这里部分代码省略.........
示例14:
WebDragData::WebDragData(const WTF::PassRefPtr<WebCore::ChromiumDataObject>& data)
: m_private(static_cast<WebDragDataPrivate*>(data.releaseRef()))
{
}
示例15: unregisterNode
void SamplerApollo::unregisterNode(WTF::PassRefPtr<BaseSamplerNode> node)
{
ASSERT(node.get());
// invalidate the cached node if it is going to be deleted
if (m_cachedSearchNode.get() == node.get())
m_cachedSearchNode.clear();
m_liveNodes.remove(node->ptr());
m_liveNodesByIdentifier.remove(node->identifier());
#if !ENABLE(JIT)
// the references from RefPtr
ASSERT(node->hasOneRef());
#endif
// when sampling is stopped don't bother to keep the dead object.
if (samplerWillDeallocate(node.get())) {
WTF::PassRefPtr<DeadSamplerNode> deadNode = DeadSamplerNode::createWithDataFrom(node.get());
ASSERT(deadNode->hasOneRef());
m_deadNodesByIdentifier.add(node->identifier(), deadNode.get());
}
#if ENABLE(JIT)
node->clearPtr();
#endif
}