OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_GUEST_TO_HOST_CHANNEL_H_ |
| 6 #define CONTENT_RENDERER_GUEST_TO_HOST_CHANNEL_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "content/renderer/gpu/webgraphicscontext3d_guest.h" |
| 10 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
| 11 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 12 #include "ipc/ipc_channel_handle.h" |
| 13 #include "ppapi/c/pp_bool.h" |
| 14 #include "ppapi/c/pp_instance.h" |
| 15 #include "ppapi/shared_impl/ppb_view_shared.h" |
| 16 #include "ppapi/proxy/proxy_channel.h" |
| 17 #include "ppapi/proxy/serialized_var.h" |
| 18 #include "ppapi/shared_impl/host_resource.h" |
| 19 #include "ppapi/shared_impl/ppapi_preferences.h" |
| 20 #include "ppapi/shared_impl/ppb_input_event_shared.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC
ontext3D.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 23 |
| 24 class GuestRenderViewObserver; |
| 25 |
| 26 namespace gpu { |
| 27 class CommandBuffer; |
| 28 } |
| 29 |
| 30 class GuestToHostChannel: public ppapi::proxy::ProxyChannel { |
| 31 public: |
| 32 class ProxyChannelDelegateImpl: |
| 33 public ppapi::proxy::ProxyChannel::Delegate { |
| 34 public: |
| 35 virtual ~ProxyChannelDelegateImpl() { } |
| 36 |
| 37 // Returns the dedicated message loop for processing IPC requests. |
| 38 virtual base::MessageLoopProxy* GetIPCMessageLoop(); |
| 39 |
| 40 // Returns the event object that becomes signalled when the main thread's |
| 41 // message loop exits. |
| 42 virtual base::WaitableEvent* GetShutdownEvent(); |
| 43 }; |
| 44 |
| 45 GuestToHostChannel(GuestRenderViewObserver* guest, |
| 46 WebKit::WebView* webview); |
| 47 |
| 48 virtual ~GuestToHostChannel() { } |
| 49 |
| 50 bool InitChannel(const IPC::ChannelHandle& channel_handle); |
| 51 |
| 52 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 53 |
| 54 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 55 |
| 56 virtual void OnChannelError() OVERRIDE; |
| 57 |
| 58 WebKit::WebGraphicsContext3D* GetWebGraphicsContext3D(); |
| 59 |
| 60 int width() const { return width_; } |
| 61 |
| 62 int height() const { return height_; } |
| 63 |
| 64 private: |
| 65 friend class WebGraphicsContext3DGuest; |
| 66 |
| 67 void IssueSwapBuffers(); |
| 68 |
| 69 bool BindGraphics(); |
| 70 |
| 71 void RequestInputEvents(); |
| 72 |
| 73 void CreateGraphicsContext(); |
| 74 |
| 75 void OnMsgSupportsInterface(const std::string& interface_name, bool*result); |
| 76 |
| 77 void OnMsgSetPreferences(const ppapi::Preferences& prefs); |
| 78 |
| 79 void OnMsgReserveInstanceId(PP_Instance instance, bool* usable); |
| 80 |
| 81 // Message handlers from ppp_instance_proxy |
| 82 void OnPluginMsgDidCreate(PP_Instance instance, |
| 83 const std::vector<std::string>& argn, |
| 84 const std::vector<std::string>& argv, |
| 85 PP_Bool* result); |
| 86 void OnPluginMsgDidDestroy(PP_Instance instance); |
| 87 void OnPluginMsgDidChangeView(PP_Instance instance, |
| 88 const ppapi::ViewData& new_data, |
| 89 PP_Bool flash_fullscreen); |
| 90 void OnPluginMsgDidChangeFocus(PP_Instance instance, PP_Bool has_focus); |
| 91 void OnPluginMsgHandleDocumentLoad(PP_Instance instance, |
| 92 const ppapi::HostResource& url_loader, |
| 93 PP_Bool* result); |
| 94 |
| 95 // Message handlers from ppp_instance_private_proxy |
| 96 void OnMsgGetInstanceObject(PP_Instance instance, |
| 97 ppapi::proxy::SerializedVarReturnValue result); |
| 98 |
| 99 // Message handlers from ppp_messaging_proxy |
| 100 void OnMsgHandleMessage(PP_Instance instance, |
| 101 ppapi::proxy::SerializedVarReceiveInput data); |
| 102 |
| 103 // Message handlers from ppp_input_event_proxy |
| 104 void OnMsgHandleInputEvent(PP_Instance instance, |
| 105 const ppapi::InputEventData& data); |
| 106 void OnMsgHandleFilteredInputEvent(PP_Instance instance, |
| 107 const ppapi::InputEventData& data, |
| 108 PP_Bool* result); |
| 109 |
| 110 // Message handlers from ppb_graphics_3d_proxy |
| 111 void OnMsgSwapBuffersACK(const ppapi::HostResource& context, |
| 112 int32_t pp_error); |
| 113 |
| 114 // Message handlers from ppp_graphics3d_proxy |
| 115 void OnMsgContextLost(PP_Instance instance); |
| 116 |
| 117 WebKit::WebView* webview_; |
| 118 GuestRenderViewObserver* guest_; |
| 119 ProxyChannelDelegateImpl delegate_; |
| 120 PP_Instance instance_; |
| 121 ppapi::HostResource resource_; |
| 122 scoped_ptr<WebGraphicsContext3DGuest> context_; |
| 123 int width_; |
| 124 int height_; |
| 125 }; |
| 126 #endif |
OLD | NEW |