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

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

Issue 337203003: Move PPB_TrueTypeFont_Dev host from renderer to browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Check fd / HANDLE / FontRef for validity. 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_host.h
diff --git a/content/browser/renderer_host/pepper/pepper_truetype_font_host.h b/content/browser/renderer_host/pepper/pepper_truetype_font_host.h
new file mode 100644
index 0000000000000000000000000000000000000000..7e9696cafe953ba4651ffcb6eae3b9296286155c
--- /dev/null
+++ b/content/browser/renderer_host/pepper/pepper_truetype_font_host.h
@@ -0,0 +1,69 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TRUETYPE_FONT_HOST_H_
+#define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TRUETYPE_FONT_HOST_H_
+
+#include <string>
+#include <vector>
+
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/sequenced_task_runner.h"
+#include "content/browser/renderer_host/pepper/pepper_truetype_font.h"
+#include "content/common/content_export.h"
+#include "ppapi/host/host_message_context.h"
+#include "ppapi/host/resource_host.h"
+
+namespace content {
+
+class BrowserPpapiHost;
+
+class CONTENT_EXPORT PepperTrueTypeFontHost : public ppapi::host::ResourceHost {
+ public:
+ PepperTrueTypeFontHost(BrowserPpapiHost* host,
+ PP_Instance instance,
+ PP_Resource resource,
+ const ppapi::proxy::SerializedTrueTypeFontDesc& desc);
+
+ virtual ~PepperTrueTypeFontHost();
+
+ virtual int32_t OnResourceMessageReceived(
+ const IPC::Message& msg,
+ ppapi::host::HostMessageContext* context) OVERRIDE;
+
+ private:
+ int32_t OnHostMsgGetTableTags(ppapi::host::HostMessageContext* context);
+ int32_t OnHostMsgGetTable(ppapi::host::HostMessageContext* context,
+ uint32_t table,
+ int32_t offset,
+ int32_t max_data_length);
+
+ void OnInitializeComplete(ppapi::proxy::SerializedTrueTypeFontDesc* desc,
+ int32_t result);
+ void OnGetTableTagsComplete(std::vector<uint32_t>* tags,
+ ppapi::host::ReplyMessageContext reply_context,
+ int32_t result);
+ void OnGetTableComplete(std::string* data,
+ ppapi::host::ReplyMessageContext reply_context,
+ int32_t result);
+
+ // We use a SequencedTaskRunner to run potentially slow font operations and
+ // ensure that Initialize completes before we make any calls to get font data.
+ // Even though we allow multiple pending GetTableTags and GetTable calls, this
+ // implies that they run serially.
+ scoped_refptr<base::SequencedTaskRunner> task_runner_;
+
+ scoped_refptr<PepperTrueTypeFont> font_;
+ bool initialize_completed_;
+
+ base::WeakPtrFactory<PepperTrueTypeFontHost> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(PepperTrueTypeFontHost);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TRUETYPE_FONT_HOST_H_

Powered by Google App Engine
This is Rietveld 408576698