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

Unified Diff: ppapi/proxy/flash_font_file_resource.cc

Issue 1147883002: Cleanup some PPAPI proxy code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SIZE_MAX Created 5 years, 7 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/proxy/flash_font_file_resource.h ('k') | ppapi/proxy/pdf_resource.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/flash_font_file_resource.cc
diff --git a/ppapi/proxy/flash_font_file_resource.cc b/ppapi/proxy/flash_font_file_resource.cc
index 86caf1fff98490b6568af511f6f95955c782074c..659aa652bd94ae36809ea97673df61debcfe6ff6 100644
--- a/ppapi/proxy/flash_font_file_resource.cc
+++ b/ppapi/proxy/flash_font_file_resource.cc
@@ -42,7 +42,7 @@ PP_Bool FlashFontFileResource::GetFontTable(uint32_t table,
RENDERER, PpapiHostMsg_FlashFontFile_Create(description_, charset_));
}
- std::string* contents = GetFontTable(table);
+ const std::string* contents = GetFontTable(table);
if (!contents) {
std::string out_contents;
int32_t result = SyncCall<PpapiPluginMsg_FlashFontFile_GetFontTableReply>(
@@ -64,18 +64,17 @@ PP_Bool FlashFontFileResource::GetFontTable(uint32_t table,
return PP_TRUE;
}
-std::string* FlashFontFileResource::GetFontTable(uint32_t table) const {
+const std::string* FlashFontFileResource::GetFontTable(uint32_t table) const {
FontTableMap::const_iterator found = font_tables_.find(table);
- if (found == font_tables_.end())
- return NULL;
- return found->second.get();
+ return (found != font_tables_.end()) ? found->second : nullptr;
}
-std::string* FlashFontFileResource::AddFontTable(uint32_t table,
- const std::string& contents) {
- linked_ptr<std::string> heap_string(new std::string(contents));
- font_tables_[table] = heap_string;
- return heap_string.get();
+const std::string* FlashFontFileResource::AddFontTable(
+ uint32_t table,
+ const std::string& contents) {
+ FontTableMap::const_iterator it =
+ font_tables_.set(table, make_scoped_ptr(new std::string(contents)));
+ return it->second;
}
} // namespace proxy
« no previous file with comments | « ppapi/proxy/flash_font_file_resource.h ('k') | ppapi/proxy/pdf_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698