Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Unified Diff: ppapi/shared_impl/private/ppb_font_shared.cc

Issue 9317100: Use the correct Resource constructor for PPB_Font_Shared in the plugin process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/shared_impl/private/ppb_font_shared.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ppapi/shared_impl/private/ppb_font_shared.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698