| Index: ppapi/shared_impl/private/ppb_font_shared.cc
|
| diff --git a/ppapi/shared_impl/private/ppb_font_shared.cc b/ppapi/shared_impl/private/ppb_font_shared.cc
|
| index 3af5288b5ac4ccd63ca266652e7f47b69c865b74..af2d678dbac6a0f007ccc4e47d547aeab7110174 100644
|
| --- a/ppapi/shared_impl/private/ppb_font_shared.cc
|
| +++ b/ppapi/shared_impl/private/ppb_font_shared.cc
|
| @@ -308,7 +308,8 @@ PP_Resource PPB_Font_Shared::CreateAsImpl(
|
| const ::ppapi::Preferences& prefs) {
|
| if (!::ppapi::PPB_Font_Shared::IsPPFontDescriptionValid(description))
|
| return 0;
|
| - return (new PPB_Font_Shared(instance, description, prefs))->GetReference();
|
| + return (new PPB_Font_Shared(InitAsImpl(), instance, description,
|
| + prefs))->GetReference();
|
| }
|
|
|
| // static
|
| @@ -316,17 +317,26 @@ PP_Resource PPB_Font_Shared::CreateAsProxy(
|
| PP_Instance instance,
|
| const PP_FontDescription_Dev& description,
|
| const ::ppapi::Preferences& prefs) {
|
| - return CreateAsImpl(instance, description, prefs);
|
| + if (!::ppapi::PPB_Font_Shared::IsPPFontDescriptionValid(description))
|
| + return 0;
|
| + return (new PPB_Font_Shared(InitAsProxy(), instance, description,
|
| + prefs))->GetReference();
|
| }
|
|
|
| -PPB_Font_Shared::PPB_Font_Shared(PP_Instance pp_instance,
|
| +PPB_Font_Shared::PPB_Font_Shared(const InitAsImpl&,
|
| + PP_Instance pp_instance,
|
| const PP_FontDescription_Dev& desc,
|
| const ::ppapi::Preferences& prefs)
|
| : Resource(pp_instance) {
|
| - StringVar* face_name = StringVar::FromPPVar(desc.face);
|
| + Initialize(desc, prefs);
|
| +}
|
|
|
| - font_impl_.reset(new FontImpl(
|
| - desc, face_name ? face_name->value() : std::string(), prefs));
|
| +PPB_Font_Shared::PPB_Font_Shared(const InitAsProxy&,
|
| + PP_Instance pp_instance,
|
| + const PP_FontDescription_Dev& desc,
|
| + const ::ppapi::Preferences& prefs)
|
| + : Resource(HostResource::MakeInstanceOnly(pp_instance)) {
|
| + Initialize(desc, prefs);
|
| }
|
|
|
| PPB_Font_Shared::~PPB_Font_Shared() {
|
| @@ -415,5 +425,13 @@ int32_t PPB_Font_Shared::PixelOffsetForCharacter(const PP_TextRun_Dev* text,
|
| return result;
|
| }
|
|
|
| +void PPB_Font_Shared::Initialize(const PP_FontDescription_Dev& desc,
|
| + const ::ppapi::Preferences& prefs) {
|
| + StringVar* face_name = StringVar::FromPPVar(desc.face);
|
| +
|
| + font_impl_.reset(new FontImpl(
|
| + desc, face_name ? face_name->value() : std::string(), prefs));
|
| +}
|
| +
|
| } // namespace ppapi
|
|
|
|
|