Adapt to changes of Chrome 51 API changes (Part 2)

This commit is contained in:
Cheng Zhao 2016-05-23 12:28:59 +09:00
parent 7ba391da7c
commit a2bd55dd3c
48 changed files with 131 additions and 131 deletions

View file

@ -24,7 +24,7 @@ ChromeRendererPepperHostFactory::ChromeRendererPepperHostFactory(
ChromeRendererPepperHostFactory::~ChromeRendererPepperHostFactory() {}
scoped_ptr<ResourceHost> ChromeRendererPepperHostFactory::CreateResourceHost(
std::unique_ptr<ResourceHost> ChromeRendererPepperHostFactory::CreateResourceHost(
ppapi::host::PpapiHost* host,
PP_Resource resource,
PP_Instance instance,
@ -33,24 +33,24 @@ scoped_ptr<ResourceHost> ChromeRendererPepperHostFactory::CreateResourceHost(
// Make sure the plugin is giving us a valid instance for this resource.
if (!host_->IsValidInstance(instance))
return scoped_ptr<ResourceHost>();
return std::unique_ptr<ResourceHost>();
if (host_->GetPpapiHost()->permissions().HasPermission(
ppapi::PERMISSION_FLASH)) {
switch (message.type()) {
case PpapiHostMsg_Flash_Create::ID: {
return scoped_ptr<ResourceHost>(
return std::unique_ptr<ResourceHost>(
new PepperFlashRendererHost(host_, instance, resource));
}
case PpapiHostMsg_FlashFullscreen_Create::ID: {
return scoped_ptr<ResourceHost>(
return std::unique_ptr<ResourceHost>(
new PepperFlashFullscreenHost(host_, instance, resource));
}
case PpapiHostMsg_FlashMenu_Create::ID: {
ppapi::proxy::SerializedFlashMenu serialized_menu;
if (ppapi::UnpackMessage<PpapiHostMsg_FlashMenu_Create>(
message, &serialized_menu)) {
return scoped_ptr<ResourceHost>(new PepperFlashMenuHost(
return std::unique_ptr<ResourceHost>(new PepperFlashMenuHost(
host_, instance, resource, serialized_menu));
}
break;
@ -71,7 +71,7 @@ scoped_ptr<ResourceHost> ChromeRendererPepperHostFactory::CreateResourceHost(
PP_PrivateFontCharset charset;
if (ppapi::UnpackMessage<PpapiHostMsg_FlashFontFile_Create>(
message, &description, &charset)) {
return scoped_ptr<ResourceHost>(new PepperFlashFontFileHost(
return std::unique_ptr<ResourceHost>(new PepperFlashFontFileHost(
host_, instance, resource, description, charset));
}
break;
@ -79,5 +79,5 @@ scoped_ptr<ResourceHost> ChromeRendererPepperHostFactory::CreateResourceHost(
}
}
return scoped_ptr<ResourceHost>();
return std::unique_ptr<ResourceHost>();
}

View file

@ -5,6 +5,7 @@
#ifndef CHROME_RENDERER_PEPPER_CHROME_RENDERER_PEPPER_HOST_FACTORY_H_
#define CHROME_RENDERER_PEPPER_CHROME_RENDERER_PEPPER_HOST_FACTORY_H_
#include "base/macros.h"
#include "ppapi/host/host_factory.h"
namespace content {
@ -17,7 +18,7 @@ class ChromeRendererPepperHostFactory : public ppapi::host::HostFactory {
~ChromeRendererPepperHostFactory() override;
// HostFactory.
scoped_ptr<ppapi::host::ResourceHost> CreateResourceHost(
std::unique_ptr<ppapi::host::ResourceHost> CreateResourceHost(
ppapi::host::PpapiHost* host,
PP_Resource resource,
PP_Instance instance,

View file

@ -205,7 +205,7 @@ int32_t PepperFlashRendererHost::OnDrawGlyphs(
style |= SkTypeface::kBold;
if (params.font_desc.italic)
style |= SkTypeface::kItalic;
skia::RefPtr<SkTypeface> typeface = skia::AdoptRef(SkTypeface::CreateFromName(
sk_sp<SkTypeface> typeface(SkTypeface::CreateFromName(
params.font_desc.face.c_str(), static_cast<SkTypeface::Style>(style)));
if (!typeface)
return PP_ERROR_FAILED;
@ -255,7 +255,7 @@ int32_t PepperFlashRendererHost::OnDrawGlyphs(
paint.setAntiAlias(true);
paint.setHinting(SkPaint::kFull_Hinting);
paint.setTextSize(SkIntToScalar(params.font_desc.size));
paint.setTypeface(typeface.get()); // Takes a ref and manages lifetime.
paint.setTypeface(std::move(typeface));
if (params.allow_subpixel_aa) {
paint.setSubpixelText(true);
paint.setLCDRenderText(true);

View file

@ -18,9 +18,9 @@ void PepperHelper::DidCreatePepperPlugin(content::RendererPpapiHost* host) {
// TODO(brettw) figure out how to hook up the host factory. It needs some
// kind of filter-like system to allow dynamic additions.
host->GetPpapiHost()->AddHostFactoryFilter(
scoped_ptr<ppapi::host::HostFactory>(
std::unique_ptr<ppapi::host::HostFactory>(
new ChromeRendererPepperHostFactory(host)));
host->GetPpapiHost()->AddInstanceMessageFilter(
scoped_ptr<ppapi::host::InstanceMessageFilter>(
std::unique_ptr<ppapi::host::InstanceMessageFilter>(
new PepperSharedMemoryMessageFilter(host)));
}

View file

@ -43,7 +43,7 @@ void PepperSharedMemoryMessageFilter::OnHostMsgCreateSharedMemory(
ppapi::proxy::SerializedHandle* plugin_handle) {
plugin_handle->set_null_shmem();
*host_handle_id = -1;
scoped_ptr<base::SharedMemory> shm(
std::unique_ptr<base::SharedMemory> shm(
content::RenderThread::Get()->HostAllocateSharedMemoryBuffer(size));
if (!shm.get())
return;

View file

@ -1169,7 +1169,7 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem(
if (buf_size == 0)
return false;
scoped_ptr<base::SharedMemory> shared_buf(
std::unique_ptr<base::SharedMemory> shared_buf(
content::RenderThread::Get()->HostAllocateSharedMemoryBuffer(buf_size));
if (!shared_buf)
return false;

View file

@ -244,10 +244,10 @@ class PrintWebViewHelper
void SetPrintPagesParams(const PrintMsg_PrintPages_Params& settings);
// WebView used only to print the selection.
scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_;
std::unique_ptr<PrepareFrameAndViewForPrint> prep_frame_view_;
bool reset_prep_frame_view_;
scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_;
std::unique_ptr<PrintMsg_PrintPages_Params> print_pages_params_;
bool is_print_ready_metafile_sent_;
bool ignore_css_margins_;
@ -343,8 +343,8 @@ class PrintWebViewHelper
FrameReference source_frame_;
blink::WebNode source_node_;
scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_;
scoped_ptr<PdfMetafileSkia> metafile_;
std::unique_ptr<PrepareFrameAndViewForPrint> prep_frame_view_;
std::unique_ptr<PdfMetafileSkia> metafile_;
// Total page count in the renderer.
int total_page_count_;

View file

@ -29,7 +29,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
PrintMsg_PrintPage_Params page_params;
page_params.params = print_params;
page_params.page_number = page_number;
scoped_ptr<PdfMetafileSkia> draft_metafile;
std::unique_ptr<PdfMetafileSkia> draft_metafile;
PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile();
if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) {
draft_metafile.reset(new PdfMetafileSkia);

View file

@ -54,7 +54,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
int page_number,
const PrintMsg_Print_Params& print_params) {
PrintMsg_Print_Params printParams = print_params;
scoped_ptr<PdfMetafileSkia> draft_metafile;
std::unique_ptr<PdfMetafileSkia> draft_metafile;
PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile();
bool render_to_draft = print_preview_context_.IsModifiable() &&

View file

@ -27,7 +27,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
PrintMsg_PrintPage_Params page_params;
page_params.params = print_params;
page_params.page_number = page_number;
scoped_ptr<PdfMetafileSkia> draft_metafile;
std::unique_ptr<PdfMetafileSkia> draft_metafile;
PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile();
if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) {
draft_metafile.reset(new PdfMetafileSkia);

View file

@ -322,7 +322,7 @@ bool SpellcheckWordIterator::Initialize(
if (rule.empty())
return false;
scoped_ptr<base::i18n::BreakIterator> iterator(
std::unique_ptr<base::i18n::BreakIterator> iterator(
new base::i18n::BreakIterator(base::string16(), rule));
if (!iterator->Init()) {
// Since we're not passing in any text, the only reason this could fail

View file

@ -167,7 +167,7 @@ class SpellcheckWordIterator {
const SpellcheckCharAttribute* attribute_;
// The break iterator.
scoped_ptr<base::i18n::BreakIterator> iterator_;
std::unique_ptr<base::i18n::BreakIterator> iterator_;
DISALLOW_COPY_AND_ASSIGN(SpellcheckWordIterator);
};