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

Unified Diff: content/browser/renderer_host/pepper/pepper_truetype_font.h

Issue 337203003: Move PPB_TrueTypeFont_Dev host from renderer to browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
Index: content/browser/renderer_host/pepper/pepper_truetype_font.h
diff --git a/content/renderer/pepper/pepper_truetype_font.h b/content/browser/renderer_host/pepper/pepper_truetype_font.h
similarity index 59%
rename from content/renderer/pepper/pepper_truetype_font.h
rename to content/browser/renderer_host/pepper/pepper_truetype_font.h
index 8eb6bd7adbc4b3ff6e40f73d7a3c97951acb9563..c2593ede64710b2124a9bd7455f3494c36978e8a 100644
--- a/content/renderer/pepper/pepper_truetype_font.h
+++ b/content/browser/renderer_host/pepper/pepper_truetype_font.h
@@ -2,49 +2,56 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_RENDERER_PEPPER_PEPPER_TRUETYPE_FONT_H_
-#define CONTENT_RENDERER_PEPPER_PEPPER_TRUETYPE_FONT_H_
+#ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TRUETYPE_FONT_H_
+#define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TRUETYPE_FONT_H_
#include <string>
#include <vector>
+#include "base/memory/ref_counted.h"
#include "ppapi/proxy/serialized_structs.h"
namespace content {
-class PepperTrueTypeFont {
+class PepperTrueTypeFont : public base::RefCounted<PepperTrueTypeFont> {
piman 2014/06/19 20:03:42 RefCountedThreadSafe since you pass references to
bbudge 2014/06/21 14:12:49 Done.
public:
// Creates a font matching the given descriptor. The exact font that is
// returned will depend on the host platform's font matching and fallback
- // algorithm.
- static PepperTrueTypeFont* Create(
+ // algorithm. Returns NULL if the font couldn't be created.
+ static scoped_refptr<PepperTrueTypeFont> Create(
const ppapi::proxy::SerializedTrueTypeFontDesc& desc);
- virtual ~PepperTrueTypeFont() {}
-
- // Returns true if the font was successfully created, false otherwise.
- virtual bool IsValid() = 0;
// Returns a description of the actual font. Use this to see the actual
// characteristics of the font after running the host platform's font matching
// and fallback algorithm. Returns PP_OK on success, a Pepper error code on
// failure. 'desc' is written only on success.
- virtual int32_t Describe(ppapi::proxy::SerializedTrueTypeFontDesc* desc) = 0;
+ // NOTE: This method may perform long blocking file IO.
+ virtual int32_t Describe(
+ ppapi::proxy::SerializedTrueTypeFontDesc* desc) const = 0;
// Retrieves an array of TrueType table tags contained in this font. Returns
// the number of tags on success, a Pepper error code on failure. 'tags' are
// written only on success.
- virtual int32_t GetTableTags(std::vector<uint32_t>* tags) = 0;
+ // NOTE: This method may perform long blocking file IO.
+ virtual int32_t GetTableTags(std::vector<uint32_t>* tags) const = 0;
// Gets a TrueType font table corresponding to the given tag. The 'offset' and
// 'max_data_length' parameters determine what part of the table is returned.
// Returns the data size in bytes on success, a Pepper error code on failure.
// 'data' is written only on success.
+ // NOTE: This method may perform long blocking file IO.
virtual int32_t GetTable(uint32_t table_tag,
int32_t offset,
int32_t max_data_length,
- std::string* data) = 0;
+ std::string* data) const = 0;
+
+ protected:
+ friend class base::RefCounted<PepperTrueTypeFont>;
+ virtual ~PepperTrueTypeFont() {};
+
+ virtual bool IsValid() const = 0;
piman 2014/06/19 20:03:42 nit: you don't need this to be virtual since the o
bbudge 2014/06/21 14:12:49 This method was eliminated.
};
} // namespace content
-#endif // CONTENT_RENDERER_PEPPER_PEPPER_TRUETYPE_FONT_H_
+#endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TRUETYPE_FONT_H_

Powered by Google App Engine
This is Rietveld 408576698