diff options
80 files changed, 3504 insertions, 2197 deletions
diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc index bd5b7f5..0a15278 100644 --- a/content/renderer/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper_plugin_delegate_impl.cc @@ -1813,14 +1813,14 @@ int32_t PepperPluginDelegateImpl::ShowContextMenu( params.custom_items = menu->menu_data(); // Transform the position to be in render view's coordinates. - if (instance->IsFullscreen(instance->pp_instance()) || + if (instance->view_data().is_fullscreen || instance->FlashIsFullscreen(instance->pp_instance())) { WebKit::WebRect rect = render_view_->windowRect(); params.x -= rect.x; params.y -= rect.y; } else { - params.x += instance->position().x(); - params.y += instance->position().y(); + params.x += instance->view_data().rect.point.x; + params.y += instance->view_data().rect.point.y; } IPC::Message* msg = new ViewHostMsg_ContextMenu(render_view_->routing_id(), diff --git a/ppapi/api/ppb_view.idl b/ppapi/api/ppb_view.idl new file mode 100644 index 0000000..48a3ef7 --- /dev/null +++ b/ppapi/api/ppb_view.idl @@ -0,0 +1,139 @@ +/* Copyright (c) 2011 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. + */ + +/** + * Defines the <code>PPB_View</code> struct representing the state of the + * view of an instance. + */ + +label Chrome { + M18 = 1.0 +}; + +/** + * <code>PPB_View</code> represents the state of the view of an instance. + * You can get a View object with the <code>PPB_Instance.GetView()</code> + * function. Additionally, all </code>PPB_ViewChanged</code> objects are also + * <code>PPB_View</code> objects so you will receive new view information via + * <code>PPP_Instance.DidChangeView</code>. + */ +[macro="PPB_VIEW_INTERFACE"] +interface PPB_View { + /** + * <code>IsView()</code> determines if the given resource is a valid + * <code>PPB_View</code> resource. Note that <code>PPB_ViewChanged</code> + * resources derive from <code>PPB_View</code> and will return true here + * as well. + * + * @return <code>PP_TRUE</code> if the given resource supports + * <code>PPB_View</code> or <code>PP_FALSE</code> if it is an invalid + * resource or is a resource of another type. + */ + PP_Bool IsView([in] PP_Resource resource); + + /** + * <code>GetRect()</code> retrieves the rectangle of the instance + * associated with the view changed notification relative to the upper left + * of the browser viewport. This position changes when the page is scrolled. + * + * The returned rectangle may not be inside the visible portion of the + * viewport if the instance is scrolled off the page. Therefore, the position + * may be negative or larger than the size of the page. The size will always + * reflect the size of the plugin were it to be scrolled entirely into view. + * + * In general, most plugins will not need to worry about the position of the + * instance in the viewport, and only need to use the size. + * + * @param rect Output argument receiving the rectangle on success. + * + * @return Returns <code>PP_TRUE</code> if the resource was valid and the + * viewport rect was filled in, <code>PP_FALSE</code> if not. + */ + PP_Bool GetRect([in] PP_Resource resource, + [out] PP_Rect rect); + + /** + * <code>IsFullscreen()</code> returns whether the instance is currently + * displaying in fullscreen mode. + * + * @return <code>PP_TRUE</code> if the instance is in full screen mode, + * or <code>PP_FALSE</code> if it's not or the resource is invalid. + */ + PP_Bool IsFullscreen([in] PP_Resource resource); + + /** + * <code>IsVisible()</code> returns whether the instance is plausibly + * visible to the user. You should use this flag to throttle or stop updates + * for invisible plugins. + * + * Thie measure incorporates both whether the instance is scrolled into + * view (whether the clip rect is nonempty) and whether the page is plausibly + * visible to the user (<code>IsPageVisible()</code>). + * + * @return <code>PP_TRUE</code> if the instance is plausibly visible to the + * user, <code>PP_FALSE</code> if it is definitely not visible. + */ + PP_Bool IsVisible([in] PP_Resource resource); + + /** + * <code>IsPageVisible()</code> determines if the page that contains the + * instance is visible. The most common cause of invisible pages is that + * the page is in a background tab in the browser. + * + * Most applications should use <code>IsVisible()</code> rather than + * this function since the instance could be scrolled off of a visible + * page, and this function will still return true. However, depending on + * how your plugin interacts with the page, there may be certain updates + * that you may want to perform when the page is visible even if your + * specific instance isn't. + * + * @return <code>PP_TRUE</code> if the instance is plausibly visible to the + * user, <code>PP_FALSE</code> if it is definitely not visible. + */ + PP_Bool IsPageVisible([in] PP_Resource resource); + + /** + * <code>GetClipRect()</code> returns the clip rectangle relative to the + * upper left corner of the instance. This rectangle indicates which parts of + * the instance are scrolled into view. + * + * If the instance is scrolled off the view, the return value will be + * (0, 0, 0, 0). this state. This clip rect does <i>not</i> take into account + * page visibility. This means if the instance is scrolled into view but the + * page itself is in an invisible tab, the return rect will contain the + * visible rect assuming the page was visible. See + * <code>IsPageVisible()</code> and <code>IsVisible()</code> if you want to + * handle this case. + * + * Most applications will not need to worry about the clip. The recommended + * behavior is to do full updates if the instance is visible as determined by + * <code>IsVisible()</code> and do no updates if not. + * + * However, if the cost for computing pixels is very high for your + * application or the pages you're targeting frequently have very large + * instances with small visible portions, you may wish to optimize further. + * In this case, the clip rect will tell you which parts of the plugin to + * update. + * + * Note that painting of the page and sending of view changed updates + * happens asynchronously. This means when the user scrolls, for example, + * it is likely that the previous backing store of the instance will be used + * for the first paint, and will be updated later when your application + * generates new content with the new clip. This may cause flickering at the + * boundaries when scrolling. If you do choose to do partial updates, you may + * want to think about what color the invisible portions of your backing + * store contain (be it transparent or some background color) or to paint + * a certain region outside the clip to reduce the visual distraction when + * this happens. + * + * @param clip Output argument receiving the clip rect on success. + * + * @return Returns <code>PP_TRUE</code> if the resource was valid and the + * clip rect was filled in, <code>PP_FALSE</code> if not. + */ + PP_Bool GetClipRect([in] PP_Resource resource, + [out] PP_Rect clip); +}; + diff --git a/ppapi/api/ppp_instance.idl b/ppapi/api/ppp_instance.idl index 0ee4c74..3a5cfa8 100644 --- a/ppapi/api/ppp_instance.idl +++ b/ppapi/api/ppp_instance.idl @@ -9,7 +9,8 @@ */ label Chrome { - M14 = 1.0 + M14 = 1.0, + M17 = 1.1 }; /** @@ -110,6 +111,8 @@ interface PPP_Instance { [in] PP_Instance instance); /** + * Deprecated in 1.1 in favor of the version that takes a Resource. + * * DidChangeView() is called when the position, the size, of the clip * rectangle of the element in the browser that corresponds to this * instance has changed. @@ -157,6 +160,19 @@ interface PPP_Instance { [in] PP_Rect clip); /** + * <code>DidChangeView() is called when the position, size, or other view + * attributes of the instance has changed. + */ + [version=1.1] + void DidChangeView( + /* A PP_Instance identifying the instance whose view changed. */ + [in] PP_Instance instance, + /** + * A handle to a <code>PPB_View</code> resource identifying the new view. + */ + [in] PP_Resource view_resource); + + /** * DidChangeFocus() is called when an instance has gained or lost focus. * Having focus means that keyboard events will be sent to the instance. * An instance's default condition is that it will not have focus. @@ -218,7 +234,7 @@ interface PPP_Instance { #inline c -typedef struct PPP_Instance PPP_Instance_1_0; +typedef struct PPP_Instance PPP_Instance_1_1; #endinl diff --git a/ppapi/c/ppb_view.h b/ppapi/c/ppb_view.h new file mode 100644 index 0000000..5592817 --- /dev/null +++ b/ppapi/c/ppb_view.h @@ -0,0 +1,154 @@ +/* Copyright (c) 2011 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.
+ */
+
+/* From ppb_view.idl modified Thu Dec 15 10:22:28 2011. */
+
+#ifndef PPAPI_C_PPB_VIEW_H_
+#define PPAPI_C_PPB_VIEW_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_point.h"
+#include "ppapi/c/pp_rect.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_size.h"
+#include "ppapi/c/pp_stdint.h"
+
+#define PPB_VIEW_INTERFACE_1_0 "PPB_View;1.0"
+#define PPB_VIEW_INTERFACE PPB_VIEW_INTERFACE_1_0
+
+/**
+ * @file
+ * Defines the <code>PPB_View</code> struct representing the state of the
+ * view of an instance.
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/**
+ * <code>PPB_View</code> represents the state of the view of an instance.
+ * You can get a View object with the <code>PPB_Instance.GetView()</code>
+ * function. Additionally, all </code>PPB_ViewChanged</code> objects are also
+ * <code>PPB_View</code> objects so you will receive new view information via
+ * <code>PPP_Instance.DidChangeView</code>.
+ */
+struct PPB_View {
+ /**
+ * <code>IsView()</code> determines if the given resource is a valid
+ * <code>PPB_View</code> resource. Note that <code>PPB_ViewChanged</code>
+ * resources derive from <code>PPB_View</code> and will return true here
+ * as well.
+ *
+ * @return <code>PP_TRUE</code> if the given resource supports
+ * <code>PPB_View</code> or <code>PP_FALSE</code> if it is an invalid
+ * resource or is a resource of another type.
+ */
+ PP_Bool (*IsView)(PP_Resource resource);
+ /**
+ * <code>GetRect()</code> retrieves the rectangle of the instance
+ * associated with the view changed notification relative to the upper left
+ * of the browser viewport. This position changes when the page is scrolled.
+ *
+ * The returned rectangle may not be inside the visible portion of the
+ * viewport if the instance is scrolled off the page. Therefore, the position
+ * may be negative or larger than the size of the page. The size will always
+ * reflect the size of the plugin were it to be scrolled entirely into view.
+ *
+ * In general, most plugins will not need to worry about the position of the
+ * instance in the viewport, and only need to use the size.
+ *
+ * @param rect Output argument receiving the rectangle on success.
+ *
+ * @return Returns <code>PP_TRUE</code> if the resource was valid and the
+ * viewport rect was filled in, <code>PP_FALSE</code> if not.
+ */
+ PP_Bool (*GetRect)(PP_Resource resource, struct PP_Rect* rect);
+ /**
+ * <code>IsFullscreen()</code> returns whether the instance is currently
+ * displaying in fullscreen mode.
+ *
+ * @return <code>PP_TRUE</code> if the instance is in full screen mode,
+ * or <code>PP_FALSE</code> if it's not or the resource is invalid.
+ */
+ PP_Bool (*IsFullscreen)(PP_Resource resource);
+ /**
+ * <code>IsVisible()</code> returns whether the instance is plausibly
+ * visible to the user. You should use this flag to throttle or stop updates
+ * for invisible plugins.
+ *
+ * Thie measure incorporates both whether the instance is scrolled into
+ * view (whether the clip rect is nonempty) and whether the page is plausibly
+ * visible to the user (<code>IsPageVisible()</code>).
+ *
+ * @return <code>PP_TRUE</code> if the instance is plausibly visible to the
+ * user, <code>PP_FALSE</code> if it is definitely not visible.
+ */
+ PP_Bool (*IsVisible)(PP_Resource resource);
+ /**
+ * <code>IsPageVisible()</code> determines if the page that contains the
+ * instance is visible. The most common cause of invisible pages is that
+ * the page is in a background tab in the browser.
+ *
+ * Most applications should use <code>IsVisible()</code> rather than
+ * this function since the instance could be scrolled off of a visible
+ * page, and this function will still return true. However, depending on
+ * how your plugin interacts with the page, there may be certain updates
+ * that you may want to perform when the page is visible even if your
+ * specific instance isn't.
+ *
+ * @return <code>PP_TRUE</code> if the instance is plausibly visible to the
+ * user, <code>PP_FALSE</code> if it is definitely not visible.
+ */
+ PP_Bool (*IsPageVisible)(PP_Resource resource);
+ /**
+ * <code>GetClipRect()</code> returns the clip rectangle relative to the
+ * upper left corner of the instance. This rectangle indicates which parts of
+ * the instance are scrolled into view.
+ *
+ * If the instance is scrolled off the view, the return value will be
+ * (0, 0, 0, 0). this state. This clip rect does <i>not</i> take into account
+ * page visibility. This means if the instance is scrolled into view but the
+ * page itself is in an invisible tab, the return rect will contain the
+ * visible rect assuming the page was visible. See
+ * <code>IsPageVisible()</code> and <code>IsVisible()</code> if you want to
+ * handle this case.
+ *
+ * Most applications will not need to worry about the clip. The recommended
+ * behavior is to do full updates if the instance is visible as determined by
+ * <code>IsVisible()</code> and do no updates if not.
+ *
+ * However, if the cost for computing pixels is very high for your
+ * application or the pages you're targeting frequently have very large
+ * instances with small visible portions, you may wish to optimize further.
+ * In this case, the clip rect will tell you which parts of the plugin to
+ * update.
+ *
+ * Note that painting of the page and sending of view changed updates
+ * happens asynchronously. This means when the user scrolls, for example,
+ * it is likely that the previous backing store of the instance will be used
+ * for the first paint, and will be updated later when your application
+ * generates new content with the new clip. This may cause flickering at the
+ * boundaries when scrolling. If you do choose to do partial updates, you may
+ * want to think about what color the invisible portions of your backing
+ * store contain (be it transparent or some background color) or to paint
+ * a certain region outside the clip to reduce the visual distraction when
+ * this happens.
+ *
+ * @param clip Output argument receiving the clip rect on success.
+ *
+ * @return Returns <code>PP_TRUE</code> if the resource was valid and the
+ * clip rect was filled in, <code>PP_FALSE</code> if not.
+ */
+ PP_Bool (*GetClipRect)(PP_Resource resource, struct PP_Rect* clip);
+};
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_PPB_VIEW_H_ */
+
diff --git a/ppapi/c/ppp_instance.h b/ppapi/c/ppp_instance.h index 12ab8c0..0dd194c 100644 --- a/ppapi/c/ppp_instance.h +++ b/ppapi/c/ppp_instance.h @@ -1,206 +1,189 @@ -/* Copyright (c) 2011 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. - */ - -/* From ppp_instance.idl modified Tue Aug 23 11:29:06 2011. */ - -#ifndef PPAPI_C_PPP_INSTANCE_H_ -#define PPAPI_C_PPP_INSTANCE_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_point.h" -#include "ppapi/c/pp_rect.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_size.h" -#include "ppapi/c/pp_stdint.h" - -#define PPP_INSTANCE_INTERFACE_1_0 "PPP_Instance;1.0" -#define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_1_0 - -/** - * @file - * This file defines the <code>PPP_Instance</code> structure - a series of - * pointers to methods that you must implement in your module. - */ - - -/** - * @addtogroup Interfaces - * @{ - */ -/** - * The <code>PPP_Instance</code> interface contains pointers to a series of - * functions that you must implement in your module. These functions can be - * trivial (simply return the default return value) unless you want your module - * to handle events such as change of focus or input events (keyboard/mouse) - * events. - */ -struct PPP_Instance { - /** - * DidCreate() is a creation handler that is called when a new instance is - * created. This function is called for each instantiation on the page, - * corresponding to one \<embed\> tag on the page. - * - * Generally you would handle this call by initializing the information - * your module associates with an instance and creating a mapping from the - * given <code>PP_Instance</code> handle to this data. The - * <code>PP_Instance</code> handle will be used in subsequent calls to - * identify which instance the call pertains to. - * - * It's possible for more than one instance to be created in a single module. - * This means that you may get more than one <code>OnCreate</code> without an - * <code>OnDestroy</code> in between, and should be prepared to maintain - * multiple states associated with each instance. - * - * If this function reports a failure (by returning <code>PP_FALSE</code>), - * the instance will be deleted. - * - * @param[in] instance A new <code>PP_Instance</code> identifying one - * instance of a module. This is an opaque handle. - * - * @param[in] argc The number of arguments contained in <code>argn</code> - * and <code>argv</code>. - * - * @param[in] argn An array of argument names. These argument names are - * supplied in the \<embed\> tag, for example: - * <code>\<embed id="nacl_module" dimensions="2"\></code> will produce two - * argument names: "id" and "dimensions." - * - * @param[in] argv An array of argument values. These are the values of the - * arguments listed in the \<embed\> tag, for example - * <code>\<embed id="nacl_module" dimensions="2"\></code> will produce two - * argument values: "nacl_module" and "2". The indices of these values match - * the indices of the corresponding names in <code>argn</code>. - * - * @return <code>PP_TRUE</code> on success or <code>PP_FALSE</code> on - * failure. - */ - PP_Bool (*DidCreate)(PP_Instance instance, - uint32_t argc, - const char* argn[], - const char* argv[]); - /** - * DidDestroy() is an instance destruction handler. This function is called - * in many cases (see below) when a module instance is destroyed. It will be - * called even if DidCreate() returned failure. - * - * Generally you will handle this call by deallocating the tracking - * information and the <code>PP_Instance</code> mapping you created in the - * DidCreate() call. You can also free resources associated with this - * instance but this isn't required; all resources associated with the deleted - * instance will be automatically freed when this function returns. - * - * The instance identifier will still be valid during this call, so the module - * can perform cleanup-related tasks. Once this function returns, the - * <code>PP_Instance</code> handle will be invalid. This means that you can't - * do any asynchronous operations like network requests, file writes or - * messaging from this function since they will be immediately canceled. - * - * <strong>Note:</strong> This function will always be skipped on untrusted - * (Native Client) implementations. This function may be skipped on trusted - * implementations in certain circumstances when Chrome does "fast shutdown" - * of a web page. Fast shutdown will happen in some cases when all module - * instances are being deleted, and no cleanup functions will be called. - * The module will just be unloaded and the process terminated. - * - * @param[in] instance A <code>PP_Instance</code> identifying one instance - * of a module. - */ - void (*DidDestroy)(PP_Instance instance); - /** - * DidChangeView() is called when the position, the size, of the clip - * rectangle of the element in the browser that corresponds to this - * instance has changed. - * - * A typical implementation will check the size of the <code>position</code> - * argument and reallocate the graphics context when a different size is - * received. Note that this function will be called for scroll events where - * the size doesn't change, so you should always check that the size is - * actually different before doing any reallocations. - * - * @param[in] instance A <code>PP_Instance</code> identifying the instance - * that has changed. - * - * @param[in] position The location on the page of the instance. This is - * relative to the top left corner of the viewport, which changes as the - * page is scrolled. Generally the size of this value will be used to create - * a graphics device, and the position is ignored (most things are relative - * to the instance so the absolute position isn't useful in most cases). - * - * @param[in] clip The visible region of the instance. This is relative to - * the top left of the module's coordinate system (not the page). If the - * module is invisible, <code>clip</code> will be (0, 0, 0, 0). - * - * It's recommended to check for invisible instances and to stop - * generating graphics updates in this case to save system resources. It's - * not usually worthwhile, however, to generate partial updates according to - * the clip when the instance is partially visible. Instead, update the entire - * region. The time saved doing partial paints is usually not significant and - * it can create artifacts when scrolling (this notification is sent - * asynchronously from scrolling so there can be flashes of old content in the - * exposed regions). - */ - void (*DidChangeView)(PP_Instance instance, - const struct PP_Rect* position, - const struct PP_Rect* clip); - /** - * DidChangeFocus() is called when an instance has gained or lost focus. - * Having focus means that keyboard events will be sent to the instance. - * An instance's default condition is that it will not have focus. - * - * <strong>Note:</strong>Clicks on instances will give focus only if you - * handle the click event. Return <code>true</code> from - * <code>HandleInputEvent</code> in <code>PPP_InputEvent</code> (or use - * unfiltered events) to signal that the click event was handled. Otherwise, - * the browser will bubble the event and give focus to the element on the page - * that actually did end up consuming it. If you're not getting focus, check - * to make sure you're returning true from the mouse click in - * <code>HandleInputEvent</code>. - * - * @param[in] instance A <code>PP_Instance</code> identifying the instance - * receiving the input event. - * - * @param[in] has_focus Indicates the new focused state of the instance. - */ - void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); - /** - * HandleDocumentLoad() is called after initialize for a full-frame - * module that was instantiated based on the MIME type of a DOMWindow - * navigation. This situation only applies to modules that are pre-registered - * to handle certain MIME types. If you haven't specifically registered to - * handle a MIME type or aren't positive this applies to you, your - * implementation of this function can just return <code>PP_FALSE</code>. - * - * The given <code>url_loader</code> corresponds to a - * <code>PPB_URLLoader</code> instance that is already opened. Its response - * headers may be queried using <code>PPB_URLLoader::GetResponseInfo</code>. - * The reference count for the URL loader is not incremented automatically on - * behalf of the module. You need to increment the reference count yourself - * if you are going to keep a reference to it. - * - * This method returns <code>PP_FALSE</code> if the module cannot handle the - * data. In response to this method, the module should call - * ReadResponseBody() to read the incoming data. - * - * @param[in] instance A <code>PP_Instance</code> identifying the instance - * that should do the load. - * - * @param[in] url_loader An open <code>PPB_URLLoader</code> instance. - * - * @return <code>PP_TRUE</code> if the data was handled, - * <code>PP_FALSE</code> otherwise. - */ - PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); -}; -/** - * @} - */ - - -typedef struct PPP_Instance PPP_Instance_1_0; - -#endif /* PPAPI_C_PPP_INSTANCE_H_ */ - +/* Copyright (c) 2011 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.
+ */
+
+/* From ppp_instance.idl modified Thu Dec 15 10:30:21 2011. */
+
+#ifndef PPAPI_C_PPP_INSTANCE_H_
+#define PPAPI_C_PPP_INSTANCE_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_point.h"
+#include "ppapi/c/pp_rect.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_size.h"
+#include "ppapi/c/pp_stdint.h"
+
+#define PPP_INSTANCE_INTERFACE_1_0 "PPP_Instance;1.0"
+#define PPP_INSTANCE_INTERFACE_1_1 "PPP_Instance;1.1"
+#define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_1_1
+
+/**
+ * @file
+ * This file defines the <code>PPP_Instance</code> structure - a series of
+ * pointers to methods that you must implement in your module.
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/**
+ * The <code>PPP_Instance</code> interface contains pointers to a series of
+ * functions that you must implement in your module. These functions can be
+ * trivial (simply return the default return value) unless you want your module
+ * to handle events such as change of focus or input events (keyboard/mouse)
+ * events.
+ */
+struct PPP_Instance {
+ /**
+ * DidCreate() is a creation handler that is called when a new instance is
+ * created. This function is called for each instantiation on the page,
+ * corresponding to one \<embed\> tag on the page.
+ *
+ * Generally you would handle this call by initializing the information
+ * your module associates with an instance and creating a mapping from the
+ * given <code>PP_Instance</code> handle to this data. The
+ * <code>PP_Instance</code> handle will be used in subsequent calls to
+ * identify which instance the call pertains to.
+ *
+ * It's possible for more than one instance to be created in a single module.
+ * This means that you may get more than one <code>OnCreate</code> without an
+ * <code>OnDestroy</code> in between, and should be prepared to maintain
+ * multiple states associated with each instance.
+ *
+ * If this function reports a failure (by returning <code>PP_FALSE</code>),
+ * the instance will be deleted.
+ *
+ * @param[in] instance A new <code>PP_Instance</code> identifying one
+ * instance of a module. This is an opaque handle.
+ *
+ * @param[in] argc The number of arguments contained in <code>argn</code>
+ * and <code>argv</code>.
+ *
+ * @param[in] argn An array of argument names. These argument names are
+ * supplied in the \<embed\> tag, for example:
+ * <code>\<embed id="nacl_module" dimensions="2"\></code> will produce two
+ * argument names: "id" and "dimensions."
+ *
+ * @param[in] argv An array of argument values. These are the values of the
+ * arguments listed in the \<embed\> tag, for example
+ * <code>\<embed id="nacl_module" dimensions="2"\></code> will produce two
+ * argument values: "nacl_module" and "2". The indices of these values match
+ * the indices of the corresponding names in <code>argn</code>.
+ *
+ * @return <code>PP_TRUE</code> on success or <code>PP_FALSE</code> on
+ * failure.
+ */
+ PP_Bool (*DidCreate)(PP_Instance instance,
+ uint32_t argc,
+ const char* argn[],
+ const char* argv[]);
+ /**
+ * DidDestroy() is an instance destruction handler. This function is called
+ * in many cases (see below) when a module instance is destroyed. It will be
+ * called even if DidCreate() returned failure.
+ *
+ * Generally you will handle this call by deallocating the tracking
+ * information and the <code>PP_Instance</code> mapping you created in the
+ * DidCreate() call. You can also free resources associated with this
+ * instance but this isn't required; all resources associated with the deleted
+ * instance will be automatically freed when this function returns.
+ *
+ * The instance identifier will still be valid during this call, so the module
+ * can perform cleanup-related tasks. Once this function returns, the
+ * <code>PP_Instance</code> handle will be invalid. This means that you can't
+ * do any asynchronous operations like network requests, file writes or
+ * messaging from this function since they will be immediately canceled.
+ *
+ * <strong>Note:</strong> This function will always be skipped on untrusted
+ * (Native Client) implementations. This function may be skipped on trusted
+ * implementations in certain circumstances when Chrome does "fast shutdown"
+ * of a web page. Fast shutdown will happen in some cases when all module
+ * instances are being deleted, and no cleanup functions will be called.
+ * The module will just be unloaded and the process terminated.
+ *
+ * @param[in] instance A <code>PP_Instance</code> identifying one instance
+ * of a module.
+ */
+ void (*DidDestroy)(PP_Instance instance);
+ /**
+ * <code>DidChangeView() is called when the position, size, or other view
+ * attributes of the instance has changed.
+ */
+ void (*DidChangeView)(PP_Instance instance, PP_Resource view_resource);
+ /**
+ * DidChangeFocus() is called when an instance has gained or lost focus.
+ * Having focus means that keyboard events will be sent to the instance.
+ * An instance's default condition is that it will not have focus.
+ *
+ * <strong>Note:</strong>Clicks on instances will give focus only if you
+ * handle the click event. Return <code>true</code> from
+ * <code>HandleInputEvent</code> in <code>PPP_InputEvent</code> (or use
+ * unfiltered events) to signal that the click event was handled. Otherwise,
+ * the browser will bubble the event and give focus to the element on the page
+ * that actually did end up consuming it. If you're not getting focus, check
+ * to make sure you're returning true from the mouse click in
+ * <code>HandleInputEvent</code>.
+ *
+ * @param[in] instance A <code>PP_Instance</code> identifying the instance
+ * receiving the input event.
+ *
+ * @param[in] has_focus Indicates the new focused state of the instance.
+ */
+ void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus);
+ /**
+ * HandleDocumentLoad() is called after initialize for a full-frame
+ * module that was instantiated based on the MIME type of a DOMWindow
+ * navigation. This situation only applies to modules that are pre-registered
+ * to handle certain MIME types. If you haven't specifically registered to
+ * handle a MIME type or aren't positive this applies to you, your
+ * implementation of this function can just return <code>PP_FALSE</code>.
+ *
+ * The given <code>url_loader</code> corresponds to a
+ * <code>PPB_URLLoader</code> instance that is already opened. Its response
+ * headers may be queried using <code>PPB_URLLoader::GetResponseInfo</code>.
+ * The reference count for the URL loader is not incremented automatically on
+ * behalf of the module. You need to increment the reference count yourself
+ * if you are going to keep a reference to it.
+ *
+ * This method returns <code>PP_FALSE</code> if the module cannot handle the
+ * data. In response to this method, the module should call
+ * ReadResponseBody() to read the incoming data.
+ *
+ * @param[in] instance A <code>PP_Instance</code> identifying the instance
+ * that should do the load.
+ *
+ * @param[in] url_loader An open <code>PPB_URLLoader</code> instance.
+ *
+ * @return <code>PP_TRUE</code> if the data was handled,
+ * <code>PP_FALSE</code> otherwise.
+ */
+ PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader);
+};
+
+struct PPP_Instance_1_0 {
+ PP_Bool (*DidCreate)(PP_Instance instance,
+ uint32_t argc,
+ const char* argn[],
+ const char* argv[]);
+ void (*DidDestroy)(PP_Instance instance);
+ void (*DidChangeView)(PP_Instance instance,
+ const struct PP_Rect* position,
+ const struct PP_Rect* clip);
+ void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus);
+ PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader);
+};
+/**
+ * @}
+ */
+
+
+typedef struct PPP_Instance PPP_Instance_1_1;
+
+#endif /* PPAPI_C_PPP_INSTANCE_H_ */
+
diff --git a/ppapi/cpp/instance.cc b/ppapi/cpp/instance.cc index 72e4f02..e42adf6 100644 --- a/ppapi/cpp/instance.cc +++ b/ppapi/cpp/instance.cc @@ -17,6 +17,7 @@ #include "ppapi/cpp/point.h" #include "ppapi/cpp/resource.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/view.h" namespace pp { @@ -54,6 +55,11 @@ bool Instance::Init(uint32_t /*argc*/, const char* /*argn*/[], return true; } +void Instance::DidChangeView(const View& view) { + // Call the deprecated version for source backwards-compat. + DidChangeView(view.GetRect(), view.GetClipRect()); +} + void Instance::DidChangeView(const pp::Rect& /*position*/, const pp::Rect& /*clip*/) { } diff --git a/ppapi/cpp/instance.h b/ppapi/cpp/instance.h index 9a3bfaf..fff23cb2 100644 --- a/ppapi/cpp/instance.h +++ b/ppapi/cpp/instance.h @@ -14,6 +14,7 @@ #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" +#include "ppapi/cpp/view.h" struct PP_InputEvent; @@ -90,9 +91,23 @@ class Instance { /// @{ /// @name PPP_Instance methods for the module to override: - /// DidChangeView() is called when the position, the size, or the clip - /// rectangle of the element in the browser that corresponds to this - /// instance has changed. + /// DidChangeView() is called when the view information for the Instance + /// has changed. See the <code>View</code> object for information. + /// + /// Most implementations will want to check if the size and user visibility + /// changed, and either resize themselves or start/stop generating updates. + /// + /// You should not call the default implementation. For + /// backwards-compatibility, it will call the deprecated version of + /// DidChangeView below. + virtual void DidChangeView(const View& view); + + /// Deprecated backwards-compatible version of <code>DidChangeView()</code>. + /// New code should derive from the version that takes a + /// <code>ViewChanged</code> object rather than this version. This function + /// is called by the default implementation of the newer + /// <code>DidChangeView</code> function for source compatibility with older + /// code. /// /// A typical implementation will check the size of the <code>position</code> /// argument and reallocate the graphics context when a different size is diff --git a/ppapi/cpp/module.cc b/ppapi/cpp/module.cc index b727e46..fd130ad 100644 --- a/ppapi/cpp/module.cc +++ b/ppapi/cpp/module.cc @@ -36,6 +36,7 @@ #include "ppapi/cpp/resource.h" #include "ppapi/cpp/url_loader.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/view.h" namespace pp { @@ -89,15 +90,14 @@ void Instance_DidDestroy(PP_Instance instance) { } void Instance_DidChangeView(PP_Instance pp_instance, - const PP_Rect* position, - const PP_Rect* clip) { + PP_Resource view_resource) { Module* module_singleton = Module::Get(); if (!module_singleton) return; Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); if (!instance) return; - instance->DidChangeView(*position, *clip); + instance->DidChangeView(View(view_resource)); } void Instance_DidChangeFocus(PP_Instance pp_instance, PP_Bool has_focus) { diff --git a/ppapi/cpp/view.cc b/ppapi/cpp/view.cc new file mode 100644 index 0000000..f81bc1a --- /dev/null +++ b/ppapi/cpp/view.cc @@ -0,0 +1,62 @@ +// Copyright (c) 2011 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.
+
+#include "ppapi/cpp/view.h"
+
+#include "ppapi/c/ppb_view.h"
+#include "ppapi/cpp/module_impl.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_View>() {
+ return PPB_VIEW_INTERFACE;
+}
+
+} // namespace
+
+View::View() : Resource() {
+}
+
+View::View(PP_Resource view_resource) : Resource(view_resource) {
+}
+
+Rect View::GetRect() const {
+ if (!has_interface<PPB_View>())
+ return Rect();
+ PP_Rect out;
+ if (PP_ToBool(get_interface<PPB_View>()->GetRect(pp_resource(), &out)))
+ return Rect(out);
+ return Rect();
+}
+
+bool View::IsFullscreen() const {
+ if (!has_interface<PPB_View>())
+ return false;
+ return PP_ToBool(get_interface<PPB_View>()->IsFullscreen(pp_resource()));
+}
+
+bool View::IsVisible() const {
+ if (!has_interface<PPB_View>())
+ return false;
+ return PP_ToBool(get_interface<PPB_View>()->IsVisible(pp_resource()));
+}
+
+bool View::IsPageVisible() const {
+ if (!has_interface<PPB_View>())
+ return true;
+ return PP_ToBool(get_interface<PPB_View>()->IsPageVisible(pp_resource()));
+}
+
+Rect View::GetClipRect() const {
+ if (!has_interface<PPB_View>())
+ return Rect();
+ PP_Rect out;
+ if (PP_ToBool(get_interface<PPB_View>()->GetClipRect(pp_resource(), &out)))
+ return Rect(out);
+ return Rect();
+}
+
+} // namespace pp
diff --git a/ppapi/cpp/view.h b/ppapi/cpp/view.h new file mode 100644 index 0000000..ee925b0 --- /dev/null +++ b/ppapi/cpp/view.h @@ -0,0 +1,114 @@ +// Copyright (c) 2011 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 PPAPI_CPP_VIEW_H_
+#define PPAPI_CPP_VIEW_H_
+
+#include "ppapi/cpp/resource.h"
+#include "ppapi/cpp/rect.h"
+#include "ppapi/cpp/size.h"
+
+namespace pp {
+
+class View : public Resource {
+ public:
+ /// Default constructor for creating an is_null() <code>View</code> object.
+ View();
+
+ /// Creates a View resource, taking and holding an additional reference to
+ /// the given resource handle.
+ View(PP_Resource view_resource);
+
+ /// <code>GetRect()</code> returns the rectangle of the instance
+ /// associated with the view changed notification relative to the upper left
+ /// of the browser viewport. This position changes when the page is scrolled.
+ ///
+ /// The returned rectangle may not be inside the visible portion of the
+ /// viewport if the instance is scrolled off the page. Therefore, the
+ /// position may be negative or larger than the size of the page. The size
+ /// will always reflect the size of the plugin were it to be scrolled
+ /// entirely into view.
+ ///
+ /// In general, most plugins will not need to worry about the position of the
+ /// instance in the viewport, and only need to use the size.
+ ///
+ /// @return The rectangle of the instance. The default return value for
+ /// an invalid View is the empty rectangle.
+ Rect GetRect() const;
+
+ /// <code>IsFullscreen()</code> returns whether the instance is currently
+ /// displaying in fullscreen mode.
+ ///
+ /// @return <code>true</code> if the instance is in full screen mode,
+ /// or <code>false</code> if it's not or the resource is invalid.
+ bool IsFullscreen() const;
+
+ /// <code>IsVisible()</code> returns true if the instance is plausibly
+ /// visible to the user. You should use this flag to throttle or stop updates
+ /// for invisible plugins.
+ ///
+ /// Thie measure incorporates both whether the instance is scrolled into
+ /// view (whether the clip rect is nonempty) and whether the page is
+ /// plausibly visible to the user (<code>IsPageVisible()</code>).
+ ///
+ /// @return <code>true</code> if the instance is plausibly visible to the
+ /// user, <code>false</code> if it is definitely not visible.
+ bool IsVisible() const;
+
+ /// <code>IsPageVisible()</code> determines if the page that contains the
+ /// instance is visible. The most common cause of invisible pages is that
+ /// the page is in a background tab in the browser.
+ ///
+ /// Most applications should use <code>IsVisible()</code> rather than
+ /// this function since the instance could be scrolled off of a visible
+ /// page, and this function will still return true. However, depending on
+ /// how your plugin interacts with the page, there may be certain updates
+ /// that you may want to perform when the page is visible even if your
+ /// specific instance isn't.
+ ///
+ /// @return <code>true</code> if the instance is plausibly visible to the
+ /// user, <code>false</code> if it is definitely not visible.
+ bool IsPageVisible() const;
+
+ /// <code>GetClip()</code> returns the clip rectangle relative to the upper
+ /// left corner of the instance. This rectangle indicates which parts of the
+ /// instance are scrolled into view.
+ ///
+ /// If the instance is scrolled off the view, the return value will be
+ /// (0, 0, 0, 0). this state. This clip rect does <i>not</i> take into account
+ /// page visibility. This means if the instance is scrolled into view but the
+ /// page itself is in an invisible tab, the return rect will contain the
+ /// visible rect assuming the page was visible. See
+ /// <code>IsPageVisible()</code> and <code>IsVisible()</code> if you want
+ /// to handle this case.
+ ///
+ /// Most applications will not need to worry about the clip. The recommended
+ /// behavior is to do full updates if the instance is visible as determined by
+ /// <code>IsUserVisible()</code> and do no updates if not.
+ ///
+ /// However, if the cost for computing pixels is very high for your
+ /// application or the pages you're targeting frequently have very large
+ /// instances with only portions visible, you may wish to optimize further.
+ /// In this case, the clip rect will tell you which parts of the plugin to
+ /// update.
+ ///
+ /// Note that painting of the page and sending of view changed updates
+ /// happens asynchronously. This means when the user scrolls, for example,
+ /// it is likely that the previous backing store of the instance will be used
+ /// for the first paint, and will be updated later when your application
+ /// generates new content. This may cause flickering at the boundaries when
+ /// scrolling. If you do choose to do partial updates, you may want to think
+ /// about what color the invisible portions of your backing store contain
+ /// (be it transparent or some background color) or to paint a certain
+ /// region outside the clip to reduce the visual distraction when this
+ /// happens.
+ ///
+ /// @return The rectangle representing the visible part of the instance.
+ /// If the resource is invalid, the empty rect is returned.
+ Rect GetClipRect() const;
+};
+
+} // namespace pp
+
+#endif // PPAPI_CPP_VIEW_H_
diff --git a/ppapi/example/example.cc b/ppapi/example/example.cc index 34b39f2..72ca3ac 100644 --- a/ppapi/example/example.cc +++ b/ppapi/example/example.cc @@ -31,6 +31,7 @@ #include "ppapi/cpp/url_loader.h" #include "ppapi/cpp/url_request_info.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/view.h" static const int kStepsPerCircle = 800; @@ -166,8 +167,6 @@ class MyInstance : public pp::InstancePrivate, public MyFetcherClient { : pp::InstancePrivate(instance), time_at_last_check_(0.0), fetcher_(NULL), - width_(0), - height_(0), animation_counter_(0), print_settings_valid_(false), showing_custom_cursor_(false), @@ -220,11 +219,10 @@ class MyInstance : public pp::InstancePrivate, public MyFetcherClient { return pp::VarPrivate(this, new MyScriptableObject(this)); } - pp::ImageData PaintImage(int width, int height) { - pp::ImageData image(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL, - pp::Size(width, height), false); + pp::ImageData PaintImage(const pp::Size& size) { + pp::ImageData image(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL, size, false); if (image.is_null()) { - printf("Couldn't allocate the image data: %d, %d\n", width, height); + printf("Couldn't allocate the image data."); return image; } @@ -243,7 +241,8 @@ class MyInstance : public pp::InstancePrivate, public MyFetcherClient { float radians = static_cast<float>(animation_counter_) / kStepsPerCircle * 2 * 3.14159265358979F; - float radius = static_cast<float>(std::min(width, height)) / 2.0f - 3.0f; + float radius = + static_cast<float>(std::min(size.width(), size.height())) / 2.0f - 3.0f; int x = static_cast<int>(cos(radians) * radius + radius + 2); int y = static_cast<int>(sin(radians) * radius + radius + 2); @@ -253,27 +252,25 @@ class MyInstance : public pp::InstancePrivate, public MyFetcherClient { } void Paint() { - pp::ImageData image = PaintImage(width_, height_); + pp::ImageData image = PaintImage(device_context_.size()); if (!image.is_null()) { device_context_.ReplaceContents(&image); device_context_.Flush(pp::CompletionCallback(&FlushCallback, this)); } else { - printf("NullImage: %d, %d\n", width_, height_); + printf("NullImage\n"); } } - virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip) { + virtual void DidChangeView(const pp::View& view) { Log(PP_LOGLEVEL_LOG, "DidChangeView"); - if (position.size().width() == width_ && - position.size().height() == height_) + if (view.GetRect().size() == current_view_.GetRect().size()) return; // We don't care about the position, only the size. + current_view_ = view; - width_ = position.size().width(); - height_ = position.size().height(); printf("DidChangeView relevant change: width=%d height:%d\n", - width_, height_); + view.GetRect().width(), view.GetRect().height()); - device_context_ = pp::Graphics2D(this, pp::Size(width_, height_), false); + device_context_ = pp::Graphics2D(this, view.GetRect().size(), false); if (!BindGraphics(device_context_)) { printf("Couldn't bind the device context\n"); return; @@ -358,14 +355,13 @@ int gettimeofday(struct timeval *tv, struct timezone*) { return pp::Resource(); } - int width = static_cast<int>( - (print_settings_.printable_area.size.width / 72.0) * - print_settings_.dpi); - int height = static_cast<int>( - (print_settings_.printable_area.size.height / 72.0) * - print_settings_.dpi); - - return PaintImage(width, height); + pp::Size size(static_cast<int>( + (print_settings_.printable_area.size.width / 72.0) * + print_settings_.dpi), + static_cast<int>( + (print_settings_.printable_area.size.height / 72.0) * + print_settings_.dpi)); + return PaintImage(size); } virtual void PrintEnd() { @@ -469,10 +465,9 @@ int gettimeofday(struct timeval *tv, struct timezone*) { double time_at_last_check_; - MyFetcher* fetcher_; + pp::View current_view_; - int width_; - int height_; + MyFetcher* fetcher_; // Incremented for each flush we get. int animation_counter_; diff --git a/ppapi/examples/2d/graphics_2d_example.c b/ppapi/examples/2d/graphics_2d_example.c index 6495cdc..6a3b12d 100644 --- a/ppapi/examples/2d/graphics_2d_example.c +++ b/ppapi/examples/2d/graphics_2d_example.c @@ -9,13 +9,14 @@ #include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_module.h" -#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_rect.h" #include "ppapi/c/pp_var.h" #include "ppapi/c/ppb.h" #include "ppapi/c/ppb_core.h" #include "ppapi/c/ppb_graphics_2d.h" #include "ppapi/c/ppb_image_data.h" #include "ppapi/c/ppb_instance.h" +#include "ppapi/c/ppb_view.h" #include "ppapi/c/ppp.h" #include "ppapi/c/ppp_instance.h" @@ -25,6 +26,7 @@ const struct PPB_Core* g_core_interface; const struct PPB_Graphics2D* g_graphics_2d_interface; const struct PPB_ImageData* g_image_data_interface; const struct PPB_Instance* g_instance_interface; +const struct PPB_View* g_view_interface; /* PPP_Instance implementation -----------------------------------------------*/ @@ -139,18 +141,21 @@ void Instance_DidDestroy(PP_Instance instance) { } void Instance_DidChangeView(PP_Instance pp_instance, - const struct PP_Rect* position, - const struct PP_Rect* clip) { + PP_Resource view) { + struct PP_Rect position; struct InstanceInfo* info = FindInstance(pp_instance); if (!info) return; - if (info->last_size.width != position->size.width || - info->last_size.height != position->size.height) { + if (g_view_interface->GetRect(view, &position) == PP_FALSE) + return; + + if (info->last_size.width != position.size.width || + info->last_size.height != position.size.height) { /* Got a resize, repaint the plugin. */ - Repaint(info, &position->size); - info->last_size.width = position->size.width; - info->last_size.height = position->size.height; + Repaint(info, &position.size); + info->last_size.width = position.size.width; + info->last_size.height = position.size.height; } } @@ -185,8 +190,10 @@ PP_EXPORT int32_t PPP_InitializeModule(PP_Module module, get_browser_interface(PPB_IMAGEDATA_INTERFACE); g_graphics_2d_interface = (const struct PPB_Graphics2D*) get_browser_interface(PPB_GRAPHICS_2D_INTERFACE); + g_view_interface = (const struct PPB_View*) + get_browser_interface(PPB_VIEW_INTERFACE); if (!g_core_interface || !g_instance_interface || !g_image_data_interface || - !g_graphics_2d_interface) + !g_graphics_2d_interface || !g_view_interface) return -1; return PP_OK; diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc index 8fcb957..5167dce 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc @@ -388,6 +388,13 @@ const PPB_Testing_Dev* PPBTestingInterface() { return ppb; } +const PPB_View* PPBViewInterface() { + static const PPB_View* ppb = + static_cast<const PPB_View*>( + GetBrowserInterfaceSafe(PPB_VIEW_INTERFACE)); + return ppb; +} + const PPB_Widget_Dev* PPBWidgetInterface() { static const PPB_Widget_Dev* ppb = static_cast<const PPB_Widget_Dev*>( diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h index c5a2066e..122119e5 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h @@ -33,6 +33,7 @@ #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" #include "ppapi/c/ppb_var.h" +#include "ppapi/c/ppb_view.h" #include "ppapi/c/private/ppb_pdf.h" #include "ppapi/c/private/ppb_tcp_socket_private.h" #include "ppapi/c/private/ppb_udp_socket_private.h" @@ -124,6 +125,7 @@ const PPB_URLLoader* PPBURLLoaderInterface(); const PPB_URLRequestInfo* PPBURLRequestInfoInterface(); const PPB_URLResponseInfo* PPBURLResponseInfoInterface(); const PPB_Var* PPBVarInterface(); // shared +const PPB_View* PPBViewInterface(); const PPB_WheelInputEvent* PPBWheelInputEventInterface(); const PPB_Widget_Dev* PPBWidgetInterface(); const PPB_Zoom_Dev* PPBZoomInterface(); diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc index d31de782..437a6948 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc @@ -164,6 +164,18 @@ const void* BrowserPpp::GetPluginInterface(const char* interface_name) { interface_name, NaClSrpcErrorString(srpc_result)); is_nexe_alive_ = (srpc_result != NACL_SRPC_RESULT_INTERNAL); + // Special case PPP_Instance versioning. The plugin side of the proxy + // converts Instance 1.1 to Instance 1.0 as needed, so we want to say here + // in the browser side that any time either 1.0 or 1.1 is supported, that + // we'll support 1.1. + if (srpc_result == NACL_SRPC_RESULT_OK && !exports_interface_name && + strcmp(interface_name, PPP_INSTANCE_INTERFACE_1_1) == 0) { + srpc_result = + PppRpcClient::PPP_GetInterface(main_channel_, + PPP_INSTANCE_INTERFACE_1_0, + &exports_interface_name); + } + const void* ppp_interface = NULL; if (srpc_result != NACL_SRPC_RESULT_OK || !exports_interface_name) { ppp_interface = NULL; diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_instance.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_instance.cc index 933b973..9ddd78e 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_instance.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_instance.cc @@ -15,11 +15,14 @@ #include "native_client/src/shared/ppapi_proxy/browser_ppp.h" #include "native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h" #include "native_client/src/shared/ppapi_proxy/utility.h" +#include "native_client/src/shared/ppapi_proxy/view_data.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_var.h" #include "ppapi/c/ppp_instance.h" +#include "ppapi/c/ppb_view.h" using nacl::scoped_array; +using ppapi_proxy::ViewData; namespace ppapi_proxy { @@ -100,31 +103,23 @@ void DidDestroy(PP_Instance instance) { NaClSrpcErrorString(srpc_result)); } -void DidChangeView(PP_Instance instance, - const PP_Rect* position, - const PP_Rect* clip) { +void DidChangeView(PP_Instance instance, PP_Resource view) { DebugPrintf("PPP_Instance::DidChangeView: instance=%"NACL_PRIu32"\n", instance); - int32_t position_array[4]; - const uint32_t kPositionArraySize = NACL_ARRAY_SIZE(position_array); - position_array[0] = position->point.x; - position_array[1] = position->point.y; - position_array[2] = position->size.width; - position_array[3] = position->size.height; - int32_t clip_array[4]; - const uint32_t kClipArraySize = NACL_ARRAY_SIZE(clip_array); - clip_array[0] = clip->point.x; - clip_array[1] = clip->point.y; - clip_array[2] = clip->size.width; - clip_array[3] = clip->size.height; + ViewData view_data; + + const PPB_View* view_interface = PPBViewInterface(); + view_interface->GetRect(view, &view_data.viewport_rect); + view_data.is_fullscreen = view_interface->IsFullscreen(view); + view_data.is_page_visible = view_interface->IsPageVisible(view); + view_interface->GetClipRect(view, &view_data.clip_rect); + NaClSrpcError srpc_result = PppInstanceRpcClient::PPP_Instance_DidChangeView( GetMainSrpcChannel(instance), instance, - kPositionArraySize, - position_array, - kClipArraySize, - clip_array, - static_cast<int32_t>(PPBFullscreenInterface()->IsFullscreen(instance))); + view, + sizeof(ViewData), + reinterpret_cast<char*>(&view_data)); DebugPrintf("PPP_Instance::DidChangeView: %s\n", NaClSrpcErrorString(srpc_result)); } diff --git a/ppapi/native_client/src/shared/ppapi_proxy/build.scons b/ppapi/native_client/src/shared/ppapi_proxy/build.scons index b7b9fc5..453d781 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/build.scons +++ b/ppapi/native_client/src/shared/ppapi_proxy/build.scons @@ -155,6 +155,7 @@ env.DualLibrary('ppapi_browser', 'ppb_rpc_server.cc', 'ppp_rpc_client.cc', 'upcall_server.cc', + 'view_data.cc', common_obj,]) # Do a recursive diff of all files found in the first source directory against diff --git a/ppapi/native_client/src/shared/ppapi_proxy/nacl.scons b/ppapi/native_client/src/shared/ppapi_proxy/nacl.scons index 73403ac..38c5bf1 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/nacl.scons +++ b/ppapi/native_client/src/shared/ppapi_proxy/nacl.scons @@ -151,6 +151,7 @@ libppruntime = env.NaClSdkLibrary( 'plugin_ppb_url_request_info.cc', 'plugin_ppb_url_response_info.cc', 'plugin_ppb_var.cc', + 'plugin_ppb_view.cc', 'plugin_ppb_widget.cc', 'plugin_ppb_zoom.cc', 'plugin_ppp_find_rpc_server.cc', @@ -168,9 +169,11 @@ libppruntime = env.NaClSdkLibrary( 'plugin_resource_tracker.cc', 'plugin_threading.cc', 'plugin_upcall.cc', + 'ppp_instance_combined.cc', 'proxy_var.cc', 'proxy_var_cache.cc', 'utility.cc', + 'view_data.cc', # Autogenerated files 'ppp_rpc_server.cc', 'ppb_rpc_client.cc', diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.cc index 8efe062..cc4ce3c 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.cc @@ -109,9 +109,21 @@ const PPP_InputEvent* PPPInputEventInterface() { return static_cast<const PPP_InputEvent*>(ppp); } -const PPP_Instance* PPPInstanceInterface() { - static const void* ppp = GetPluginInterfaceSafe(PPP_INSTANCE_INTERFACE); - return static_cast<const PPP_Instance*>(ppp); +PPP_Instance_Combined* PPPInstanceInterface() { + static PPP_Instance_Combined combined; + if (!combined.initialized()) { + // Note: don't use "safe" version since that will assert if 1.1 isn't + // supported, which isn't required. + const void* instance1_1 = GetPluginInterface( + PPP_INSTANCE_INTERFACE_1_1); + if (instance1_1) { + combined.Init1_1(static_cast<const PPP_Instance_1_1*>(instance1_1)); + } else { + combined.Init1_0(static_cast<const PPP_Instance_1_0*>( + GetPluginInterfaceSafe(PPP_INSTANCE_INTERFACE_1_0))); + } + } + return &combined; } const PPP_Messaging* PPPMessagingInterface() { diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h index b470400..08cacff 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h @@ -20,6 +20,7 @@ #include "ppapi/c/ppp_instance.h" #include "ppapi/c/ppp_messaging.h" #include "ppapi/c/ppp_mouse_lock.h" +#include "native_client/src/shared/ppapi_proxy/ppp_instance_combined.h" #include "native_client/src/untrusted/irt/irt_ppapi.h" struct NaClSrpcChannel; @@ -61,7 +62,7 @@ const void* GetPluginInterface(const char* interface_name); const void* GetPluginInterfaceSafe(const char* interface_name); const PPP_Find_Dev* PPPFindInterface(); const PPP_InputEvent* PPPInputEventInterface(); -const PPP_Instance* PPPInstanceInterface(); +PPP_Instance_Combined* PPPInstanceInterface(); const PPP_Messaging* PPPMessagingInterface(); const PPP_MouseLock* PPPMouseLockInterface(); const PPP_Printing_Dev* PPPPrintingInterface(); diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_instance_data.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_instance_data.cc index 71e3241..4764a66 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_instance_data.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_instance_data.cc @@ -43,22 +43,10 @@ void PluginInstanceData::DidDestroy(PP_Instance id) { } // static -void PluginInstanceData::DidChangeView(PP_Instance id, - PP_Rect position, - PP_Rect clip, - bool is_fullscreen) { - PluginInstanceData* instance = FromPP(id); - if (instance) { - instance->position_ = position; - instance->is_fullscreen_ = is_fullscreen; - } -} - -// static bool PluginInstanceData::IsFullscreen(PP_Instance id) { PluginInstanceData* instance = FromPP(id); if (instance) - return instance->is_fullscreen_; + return instance->last_view_data_.is_fullscreen; return false; } diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_instance_data.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_instance_data.h index 412bccc..57bb9af 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_instance_data.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_instance_data.h @@ -10,6 +10,7 @@ #include "native_client/src/include/nacl_macros.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_rect.h" +#include "ppapi/native_client/src/shared/ppapi_proxy/view_data.h" namespace ppapi_proxy { @@ -19,25 +20,23 @@ class PluginInstanceData { static PluginInstanceData* FromPP(PP_Instance id); static void DidCreate(PP_Instance id); static void DidDestroy(PP_Instance id); - static void DidChangeView(PP_Instance id, PP_Rect position, PP_Rect clip, - bool is_fullscreen); static bool IsFullscreen(PP_Instance id); - PluginInstanceData(PP_Instance id) - : id_(id), position_(PP_MakeRectFromXYWH(0, 0, 0, 0)) { + PluginInstanceData(PP_Instance id) : id_(id) { } ~PluginInstanceData() {} PP_Instance id() { return id_; } - PP_Rect position() { return position_; } - bool is_fullscreen() { return is_fullscreen_; } + + void set_last_view_data(const ViewData& data) { last_view_data_ = data; } + const ViewData& last_view_data() const { return last_view_data_; } private: NACL_DISALLOW_COPY_AND_ASSIGN(PluginInstanceData); PP_Instance id_; - PP_Rect position_; - bool is_fullscreen_; + + ViewData last_view_data_; }; } // namespace ppapi_proxy diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc index d4d2511..5afd37d 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc @@ -35,6 +35,7 @@ #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.h" #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.h" #include "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h" +#include "native_client/src/shared/ppapi_proxy/plugin_ppb_view.h" #include "native_client/src/shared/ppapi_proxy/plugin_ppb_widget.h" #include "native_client/src/shared/ppapi_proxy/plugin_ppb_zoom.h" #include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h" @@ -93,6 +94,7 @@ InterfaceMapElement interface_map[] = { true }, { PPB_VAR_INTERFACE, PluginVar::GetInterface(), true }, { PPB_VAR_INTERFACE_1_0, PluginVar::GetInterface1_0(), true }, + { PPB_VIEW_INTERFACE, PluginView::GetInterface(), true }, { PPB_WHEEL_INPUT_EVENT_INTERFACE, PluginInputEvent::GetWheelInterface(), true }, { PPB_WIDGET_DEV_INTERFACE, PluginWidget::GetInterface(), true }, diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_view.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_view.cc new file mode 100644 index 0000000..2a148c2 --- /dev/null +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_view.cc @@ -0,0 +1,108 @@ +// Copyright (c) 2011 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. + +#include "native_client/src/shared/ppapi_proxy/plugin_ppb_view.h" + +#include "native_client/src/include/portability.h" +#include "native_client/src/shared/ppapi_proxy/plugin_globals.h" +#include "native_client/src/shared/ppapi_proxy/plugin_upcall.h" +#include "native_client/src/shared/ppapi_proxy/utility.h" +#include "native_client/src/shared/srpc/nacl_srpc.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_size.h" +#include "srpcgen/ppb_rpc.h" +#include "srpcgen/upcall.h" + +namespace ppapi_proxy { + +namespace { + +class ViewGetter { + public: + ViewGetter(PP_Resource resource, const char* function_name) { + DebugPrintf("PPB_View::%s: resource=%"NACL_PRIu32"\n", + function_name, + resource); + view_ = PluginResource::GetAs<PluginView>(resource); + } + + PluginView* get() { return view_.get(); } + + private: + NACL_DISALLOW_COPY_AND_ASSIGN(ViewGetter); + scoped_refptr<PluginView> view_; +}; + +// This macro is for starting a resource function. It makes sure resource_arg +// is of type PluginView, and returns error_return if it's not. +#define BEGIN_RESOURCE_THUNK(function_name, resource_arg, error_return) \ + ViewGetter view(resource_arg, function_name); \ + if (!view.get()) { \ + return error_return; \ + } + +PP_Bool IsView(PP_Resource resource) { + DebugPrintf("PPB_View::IsView: resource=%"NACL_PRIu32"\n", + resource); + return PluginResource::GetAs<PluginView>(resource).get() + ? PP_TRUE : PP_FALSE; +} + +PP_Bool GetRect(PP_Resource resource, PP_Rect* viewport) { + BEGIN_RESOURCE_THUNK("GetRect", resource, PP_FALSE); + *viewport = view.get()->view_data().viewport_rect; + return PP_TRUE; +} + +PP_Bool IsFullscreen(PP_Resource resource) { + BEGIN_RESOURCE_THUNK("IsFullscreen", resource, PP_FALSE); + return view.get()->view_data().is_fullscreen; +} + +PP_Bool IsUserVisible(PP_Resource resource) { + BEGIN_RESOURCE_THUNK("IsUserVisible", resource, PP_FALSE); + const ViewData& data = view.get()->view_data(); + return PP_FromBool(data.is_page_visible && + data.clip_rect.size.width > 0 && + data.clip_rect.size.height > 0); +} + +PP_Bool IsPageVisible(PP_Resource resource) { + BEGIN_RESOURCE_THUNK("IsPageVisible", resource, PP_FALSE); + return view.get()->view_data().is_page_visible; +} + +PP_Bool GetClipRect(PP_Resource resource, PP_Rect* clip) { + BEGIN_RESOURCE_THUNK("GetClipRect", resource, PP_FALSE); + *clip = view.get()->view_data().clip_rect; + return PP_TRUE; +} + +} // namespace + +PluginView::PluginView() { +} + +PluginView::~PluginView() { +} + +void PluginView::Init(const ViewData& view_data) { + view_data_ = view_data; +} + +const PPB_View* PluginView::GetInterface() { + static const PPB_View view_interface = { + &IsView, + &GetRect, + &IsFullscreen, + &IsUserVisible, + &IsPageVisible, + &GetClipRect + }; + return &view_interface; +} + +} // namespace ppapi_proxy diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_view.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_view.h new file mode 100644 index 0000000..6c0bfd4 --- /dev/null +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_view.h @@ -0,0 +1,41 @@ +// Copyright (c) 2011 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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_VIEW_H_
+#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_VIEW_H_
+
+#include "native_client/src/include/nacl_macros.h"
+#include "native_client/src/shared/ppapi_proxy/view_data.h"
+#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
+#include "ppapi/c/ppb_view.h"
+
+namespace ppapi_proxy {
+
+// Implements the untrusted side of the PPB_View interface.
+class PluginView : public PluginResource {
+ public:
+ PluginView();
+ void Init(const ViewData& view_data);
+ virtual ~PluginView();
+
+ // PluginResource implementation.
+ virtual bool InitFromBrowserResource(PP_Resource /*resource*/) {
+ return true;
+ }
+
+ const ViewData& view_data() const { return view_data_; }
+
+ static const PPB_View* GetInterface();
+
+ private:
+ IMPLEMENT_RESOURCE(PluginView);
+ NACL_DISALLOW_COPY_AND_ASSIGN(PluginView);
+
+ ViewData view_data_;
+};
+
+} // namespace ppapi_proxy
+
+#endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_VIEW_H_
+
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_instance_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_instance_rpc_server.cc index 3c443bf..12e997a 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_instance_rpc_server.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_instance_rpc_server.cc @@ -13,7 +13,9 @@ #include "native_client/src/shared/ppapi_proxy/object_serialize.h" #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" #include "native_client/src/shared/ppapi_proxy/plugin_instance_data.h" +#include "native_client/src/shared/ppapi_proxy/plugin_ppb_view.h" #include "native_client/src/shared/ppapi_proxy/utility.h" +#include "native_client/src/shared/ppapi_proxy/view_data.h" #include "ppapi/c/ppp.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_var.h" @@ -21,7 +23,11 @@ using nacl::scoped_ptr; using ppapi_proxy::DebugPrintf; +using ppapi_proxy::PluginInstanceData; +using ppapi_proxy::PluginResource; +using ppapi_proxy::PluginView; using ppapi_proxy::PPPInstanceInterface; +using ppapi_proxy::ViewData; namespace { @@ -114,26 +120,30 @@ void PppInstanceRpcServer::PPP_Instance_DidChangeView( NaClSrpcClosure* done, // inputs PP_Instance instance_id, - uint32_t position_count, int32_t* position, - uint32_t clip_count, int32_t* clip, - int32_t is_fullscreen) { - const PP_Rect position_rect = - PP_MakeRectFromXYWH(position[0], position[1], position[2], position[3]); - const PP_Rect clip_rect = - PP_MakeRectFromXYWH(clip[0], clip[1], clip[2], clip[3]); - - ppapi_proxy::PluginInstanceData::DidChangeView(instance_id, - position_rect, - clip_rect, - is_fullscreen); + PP_Resource resource, + nacl_abi_size_t view_size, + char* view_bytes) { rpc->result = NACL_SRPC_RESULT_APP_ERROR; NaClSrpcClosureRunner runner(done); - if (position_count != 4 || clip_count != 4) { + + if (view_size != sizeof(ViewData)) return; - } + ViewData view_data; + memcpy(&view_data, view_bytes, sizeof(ViewData)); + + ppapi_proxy::PluginInstanceData* instance_data = + ppapi_proxy::PluginInstanceData::FromPP(instance_id); + if (!instance_data) + return; + + scoped_refptr<PluginView> view = + PluginResource::AdoptAsWithNoBrowserCount<PluginView>(resource); + view->Init(view_data); + + instance_data->set_last_view_data(view_data); PPPInstanceInterface()->DidChangeView( - instance_id, &position_rect, &clip_rect); + instance_id, resource, &view_data.viewport_rect, &view_data.clip_rect); DebugPrintf("PPP_Instance::DidChangeView\n"); rpc->result = NACL_SRPC_RESULT_OK; } diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource.h index 6181165..5222127 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_resource.h @@ -21,7 +21,8 @@ namespace ppapi_proxy { F(PluginGraphics2D) \ F(PluginGraphics3D) \ F(PluginImageData) \ - F(PluginInputEvent) + F(PluginInputEvent) \ + F(PluginView) // Forward declaration of PluginResource classes. #define DECLARE_RESOURCE_CLASS(RESOURCE) class RESOURCE; diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy.gyp b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy.gyp index 97a0a69..a2be0a8 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy.gyp +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy.gyp @@ -56,7 +56,9 @@ 'browser_upcall.cc', 'input_event_data.cc', 'object_serialize.cc', + 'ppp_instance_combined.cc', 'utility.cc', + 'view_data.cc', # Autogerated files 'ppp_rpc_client.cc', 'ppb_rpc_server.cc', @@ -70,5 +72,5 @@ '<(DEPTH)/ppapi/ppapi.gyp:ppapi_c', ], }, - ], -}
\ No newline at end of file + ], +} diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp index 339c0ba..40febe21 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp @@ -77,6 +77,7 @@ 'plugin_ppb_url_request_info.cc', 'plugin_ppb_url_response_info.cc', 'plugin_ppb_var.cc', + 'plugin_ppb_view.cc', 'plugin_ppb_widget.cc', 'plugin_ppb_zoom.cc', 'plugin_ppp_find_rpc_server.cc', @@ -94,9 +95,11 @@ 'plugin_resource_tracker.cc', 'plugin_threading.cc', 'plugin_upcall.cc', + 'ppp_instance_combined.cc', 'proxy_var.cc', 'proxy_var_cache.cc', 'utility.cc', + 'view_data.cc', # Autogenerated files 'ppp_rpc_server.cc', 'ppb_rpc_client.cc', diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance.srpc index 1d54c92d..37ef109 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance.srpc +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance.srpc @@ -29,11 +29,8 @@ # Changes the position, size, or clipping rectangle of the instance. {'name': 'PPP_Instance_DidChangeView', 'inputs': [['instance', 'PP_Instance'], # PP_Instance - ['position', 'int32_t[]'], # PP_Rect* - ['clip', 'int32_t[]'], # PP_Rect* - # This arg is not part of the API, but will help us - # avoid unnecessary PPB_Fullscreen::IsFullscreen RPCs. - ['is_fullscreen', 'int32_t' ] # PP_Bool + ['resource', 'PP_Resource'], # PP_Resource + ['view_data', 'char[]'], # ViewData ], 'outputs': [] }, diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.cc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.cc new file mode 100644 index 0000000..9da2950 --- /dev/null +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.cc @@ -0,0 +1,63 @@ +// Copyright (c) 2011 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.
+
+#include "ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.h"
+
+#include <stdlib.h>
+
+namespace ppapi_proxy {
+
+PPP_Instance_Combined::PPP_Instance_Combined()
+ : initialized_(false),
+ did_change_view_1_0_(NULL) {
+}
+
+void PPP_Instance_Combined::Init1_0(const PPP_Instance_1_0* instance_if) {
+ initialized_ = true;
+ did_change_view_1_0_ = instance_if->DidChangeView;
+ instance_1_1_.DidCreate = instance_if->DidCreate;
+ instance_1_1_.DidDestroy = instance_if->DidDestroy;
+ instance_1_1_.DidChangeView = NULL;
+ instance_1_1_.DidChangeFocus = instance_if->DidChangeFocus;
+ instance_1_1_.HandleDocumentLoad = instance_if->HandleDocumentLoad;
+}
+
+void PPP_Instance_Combined::Init1_1(const PPP_Instance_1_1* instance_if) {
+ initialized_ = true;
+ instance_1_1_ = *instance_if;
+}
+
+PP_Bool PPP_Instance_Combined::DidCreate(PP_Instance instance,
+ uint32_t argc,
+ const char* argn[],
+ const char* argv[]) {
+ return instance_1_1_.DidCreate(instance, argc, argn, argv);
+}
+
+void PPP_Instance_Combined::DidDestroy(PP_Instance instance) {
+ return instance_1_1_.DidDestroy(instance);
+}
+
+void PPP_Instance_Combined::DidChangeView(PP_Instance instance,
+ PP_Resource view_resource,
+ const struct PP_Rect* position,
+ const struct PP_Rect* clip) {
+ if (instance_1_1_.DidChangeView)
+ instance_1_1_.DidChangeView(instance, view_resource);
+ else
+ did_change_view_1_0_(instance, position, clip);
+}
+
+void PPP_Instance_Combined::DidChangeFocus(PP_Instance instance,
+ PP_Bool has_focus) {
+ instance_1_1_.DidChangeFocus(instance, has_focus);
+}
+
+PP_Bool PPP_Instance_Combined::HandleDocumentLoad(PP_Instance instance,
+ PP_Resource url_loader) {
+ return instance_1_1_.HandleDocumentLoad(instance, url_loader);
+}
+
+} // namespace ppapi_proxy
+
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.h b/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.h new file mode 100644 index 0000000..d794d51 --- /dev/null +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.h @@ -0,0 +1,58 @@ +// Copyright (c) 2011 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 PPAPI_NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PPP_INSTANCE_COMBINED_H_ +#define PPAPI_NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PPP_INSTANCE_COMBINED_H_ + +#include "ppapi/c/ppp_instance.h" + +namespace ppapi_proxy { + +// This exposes the 1.1 interface and forwards it to the 1.0 interface is +// necessary. +struct PPP_Instance_Combined { + public: + // You must call one of the Init functions after the constructor. + PPP_Instance_Combined(); + + void Init1_0(const PPP_Instance_1_0* instance_if); + void Init1_1(const PPP_Instance_1_1* instance_if); + + bool initialized() const { return initialized_; } + + PP_Bool DidCreate(PP_Instance instance, + uint32_t argc, + const char* argn[], + const char* argv[]); + void DidDestroy(PP_Instance instance); + + // This version of DidChangeView encapsulates all arguments for both 1.0 + // and 1.1 versions of this function. Conversion from 1.1 -> 1.0 is easy, + // but this class doesn't have the necessary context (resource interfaces) + // to do the conversion, so the caller must do it. + void DidChangeView(PP_Instance instance, + PP_Resource view_resource, + const struct PP_Rect* position, + const struct PP_Rect* clip); + + void DidChangeFocus(PP_Instance instance, PP_Bool has_focus); + PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader); + + private: + bool initialized_; + + // For version 1.0, DidChangeView will be NULL, and DidChangeView_1_0 will + // be set below. + PPP_Instance_1_1 instance_1_1_; + + // Non-NULL when Instance 1.0 is used. + void (*did_change_view_1_0_)(PP_Instance instance, + const struct PP_Rect* position, + const struct PP_Rect* clip); +}; + +} // namespace ppapi_proxy + +#endif // PPAPI_NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PPP_INSTANCE_COMBINED_H_ + diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_client.cc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_client.cc index 8b0daac..2ff6444 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_client.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_client.cc @@ -1,473 +1,471 @@ -// Copyright (c) 2011 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. -// -// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING -// -// Automatically generated code. See srpcgen.py -// -// NaCl Simple Remote Procedure Call interface abstractions. - -#include "trusted/srpcgen/ppp_rpc.h" -#ifdef __native_client__ -#ifndef UNREFERENCED_PARAMETER -#define UNREFERENCED_PARAMETER(P) do { (void) P; } while (0) -#endif // UNREFERENCED_PARAMETER -#else -#include "native_client/src/include/portability.h" -#endif // __native_client__ -#include "native_client/src/shared/ppapi_proxy/browser_globals.h" -#include "native_client/src/shared/srpc/nacl_srpc.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_module.h" -#include "ppapi/c/pp_resource.h" - -NaClSrpcError CompletionCallbackRpcClient::RunCompletionCallback( - NaClSrpcChannel* channel, - int32_t callback_id, - int32_t result, - nacl_abi_size_t read_buffer_bytes, char* read_buffer) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "RunCompletionCallback:iiC:", - callback_id, - result, - read_buffer_bytes, read_buffer - ); - return retval; -} - -NaClSrpcError PppRpcClient::PPP_InitializeModule( - NaClSrpcChannel* channel, - int32_t pid, - PP_Module module, - NaClSrpcImcDescType upcall_channel_desc, - char* service_description, - int32_t* nacl_pid, - int32_t* success) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_InitializeModule:iihs:ii", - pid, - module, - upcall_channel_desc, - service_description, - nacl_pid, - success - ); - return retval; -} - -NaClSrpcError PppRpcClient::PPP_ShutdownModule( - NaClSrpcChannel* channel) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_ShutdownModule::" - ); - return retval; -} - -NaClSrpcError PppRpcClient::PPP_GetInterface( - NaClSrpcChannel* channel, - char* interface_name, - int32_t* exports_interface_name) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_GetInterface:s:i", - interface_name, - exports_interface_name - ); - return retval; -} - -NaClSrpcError PppAudioRpcClient::PPP_Audio_StreamCreated( - NaClSrpcChannel* channel, - PP_Instance instance, - NaClSrpcImcDescType out_shm, - int32_t out_shm_size, - NaClSrpcImcDescType out_socket) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Audio_StreamCreated:ihih:", - instance, - out_shm, - out_shm_size, - out_socket - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppFindRpcClient::PPP_Find_StartFind( - NaClSrpcChannel* channel, - PP_Instance instance, - nacl_abi_size_t text_bytes, char* text, - int32_t case_sensitive, - int32_t* supports_find) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Find_StartFind:iCi:i", - instance, - text_bytes, text, - case_sensitive, - supports_find - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppFindRpcClient::PPP_Find_SelectFindResult( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t forward) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Find_SelectFindResult:ii:", - instance, - forward - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppFindRpcClient::PPP_Find_StopFind( - NaClSrpcChannel* channel, - PP_Instance instance) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Find_StopFind:i:", - instance - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppInputEventRpcClient::PPP_InputEvent_HandleInputEvent( - NaClSrpcChannel* channel, - PP_Instance instance, - PP_Resource resource, - nacl_abi_size_t event_data_bytes, char* event_data, - nacl_abi_size_t character_text_bytes, char* character_text, - int32_t* handled) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_InputEvent_HandleInputEvent:iiCC:i", - instance, - resource, - event_data_bytes, event_data, - character_text_bytes, character_text, - handled - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppInstanceRpcClient::PPP_Instance_DidCreate( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t argc, - nacl_abi_size_t argn_bytes, char* argn, - nacl_abi_size_t argv_bytes, char* argv, - int32_t* success) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Instance_DidCreate:iiCC:i", - instance, - argc, - argn_bytes, argn, - argv_bytes, argv, - success - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppInstanceRpcClient::PPP_Instance_DidDestroy( - NaClSrpcChannel* channel, - PP_Instance instance) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Instance_DidDestroy:i:", - instance - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppInstanceRpcClient::PPP_Instance_DidChangeView( - NaClSrpcChannel* channel, - PP_Instance instance, - nacl_abi_size_t position_bytes, int32_t* position, - nacl_abi_size_t clip_bytes, int32_t* clip, - int32_t is_fullscreen) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Instance_DidChangeView:iIIi:", - instance, - position_bytes, position, - clip_bytes, clip, - is_fullscreen - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppInstanceRpcClient::PPP_Instance_DidChangeFocus( - NaClSrpcChannel* channel, - PP_Instance instance, - bool has_focus) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Instance_DidChangeFocus:ib:", - instance, - has_focus - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppInstanceRpcClient::PPP_Instance_HandleDocumentLoad( - NaClSrpcChannel* channel, - PP_Instance instance, - PP_Resource url_loader, - int32_t* success) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Instance_HandleDocumentLoad:ii:i", - instance, - url_loader, - success - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppMessagingRpcClient::PPP_Messaging_HandleMessage( - NaClSrpcChannel* channel, - PP_Instance instance, - nacl_abi_size_t message_bytes, char* message) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Messaging_HandleMessage:iC:", - instance, - message_bytes, message - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppMouseLockRpcClient::PPP_MouseLock_MouseLockLost( - NaClSrpcChannel* channel, - PP_Instance instance) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_MouseLock_MouseLockLost:i:", - instance - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppPrintingRpcClient::PPP_Printing_QuerySupportedFormats( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t* formats) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Printing_QuerySupportedFormats:i:i", - instance, - formats - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppPrintingRpcClient::PPP_Printing_Begin( - NaClSrpcChannel* channel, - PP_Instance instance, - nacl_abi_size_t print_settings_bytes, char* print_settings, - int32_t* pages_required) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Printing_Begin:iC:i", - instance, - print_settings_bytes, print_settings, - pages_required - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppPrintingRpcClient::PPP_Printing_PrintPages( - NaClSrpcChannel* channel, - PP_Instance instance, - nacl_abi_size_t page_ranges_bytes, char* page_ranges, - int32_t page_range_count, - PP_Resource* image_data) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Printing_PrintPages:iCi:i", - instance, - page_ranges_bytes, page_ranges, - page_range_count, - image_data - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppPrintingRpcClient::PPP_Printing_End( - NaClSrpcChannel* channel, - PP_Instance instance) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Printing_End:i:", - instance - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppPrintingRpcClient::PPP_Printing_IsScalingDisabled( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t* result) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Printing_IsScalingDisabled:i:i", - instance, - result - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppScrollbarRpcClient::PPP_Scrollbar_ValueChanged( - NaClSrpcChannel* channel, - PP_Instance instance, - PP_Resource scrollbar, - int32_t value) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Scrollbar_ValueChanged:iii:", - instance, - scrollbar, - value - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppScrollbarRpcClient::PPP_Scrollbar_OverlayChanged( - NaClSrpcChannel* channel, - PP_Instance instance, - PP_Resource scrollbar, - int32_t overlay) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Scrollbar_OverlayChanged:iii:", - instance, - scrollbar, - overlay - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppSelectionRpcClient::PPP_Selection_GetSelectedText( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t html, - nacl_abi_size_t* selected_text_bytes, char* selected_text) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Selection_GetSelectedText:ii:C", - instance, - html, - selected_text_bytes, selected_text - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppWidgetRpcClient::PPP_Widget_Invalidate( - NaClSrpcChannel* channel, - PP_Instance instance, - PP_Resource widget, - nacl_abi_size_t dirty_rect_bytes, char* dirty_rect) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Widget_Invalidate:iiC:", - instance, - widget, - dirty_rect_bytes, dirty_rect - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - -NaClSrpcError PppZoomRpcClient::PPP_Zoom_Zoom( - NaClSrpcChannel* channel, - PP_Instance instance, - double factor, - int32_t text_only) { - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPP_Zoom_Zoom:idi:", - instance, - factor, - text_only - ); - if (retval == NACL_SRPC_RESULT_INTERNAL) - ppapi_proxy::CleanUpAfterDeadNexe(instance); - return retval; -} - - +// Copyright (c) 2011 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.
+//
+// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+//
+// Automatically generated code. See srpcgen.py
+//
+// NaCl Simple Remote Procedure Call interface abstractions.
+
+#include "trusted/srpcgen/ppp_rpc.h"
+#ifdef __native_client__
+#ifndef UNREFERENCED_PARAMETER
+#define UNREFERENCED_PARAMETER(P) do { (void) P; } while (0)
+#endif // UNREFERENCED_PARAMETER
+#else
+#include "native_client/src/include/portability.h"
+#endif // __native_client__
+#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
+#include "native_client/src/shared/srpc/nacl_srpc.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_module.h"
+#include "ppapi/c/pp_resource.h"
+
+NaClSrpcError CompletionCallbackRpcClient::RunCompletionCallback(
+ NaClSrpcChannel* channel,
+ int32_t callback_id,
+ int32_t result,
+ nacl_abi_size_t read_buffer_bytes, char* read_buffer) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "RunCompletionCallback:iiC:",
+ callback_id,
+ result,
+ read_buffer_bytes, read_buffer
+ );
+ return retval;
+}
+
+NaClSrpcError PppRpcClient::PPP_InitializeModule(
+ NaClSrpcChannel* channel,
+ int32_t pid,
+ PP_Module module,
+ NaClSrpcImcDescType upcall_channel_desc,
+ char* service_description,
+ int32_t* nacl_pid,
+ int32_t* success) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_InitializeModule:iihs:ii",
+ pid,
+ module,
+ upcall_channel_desc,
+ service_description,
+ nacl_pid,
+ success
+ );
+ return retval;
+}
+
+NaClSrpcError PppRpcClient::PPP_ShutdownModule(
+ NaClSrpcChannel* channel) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_ShutdownModule::"
+ );
+ return retval;
+}
+
+NaClSrpcError PppRpcClient::PPP_GetInterface(
+ NaClSrpcChannel* channel,
+ char* interface_name,
+ int32_t* exports_interface_name) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_GetInterface:s:i",
+ interface_name,
+ exports_interface_name
+ );
+ return retval;
+}
+
+NaClSrpcError PppAudioRpcClient::PPP_Audio_StreamCreated(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ NaClSrpcImcDescType out_shm,
+ int32_t out_shm_size,
+ NaClSrpcImcDescType out_socket) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Audio_StreamCreated:ihih:",
+ instance,
+ out_shm,
+ out_shm_size,
+ out_socket
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppFindRpcClient::PPP_Find_StartFind(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ nacl_abi_size_t text_bytes, char* text,
+ int32_t case_sensitive,
+ int32_t* supports_find) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Find_StartFind:iCi:i",
+ instance,
+ text_bytes, text,
+ case_sensitive,
+ supports_find
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppFindRpcClient::PPP_Find_SelectFindResult(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ int32_t forward) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Find_SelectFindResult:ii:",
+ instance,
+ forward
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppFindRpcClient::PPP_Find_StopFind(
+ NaClSrpcChannel* channel,
+ PP_Instance instance) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Find_StopFind:i:",
+ instance
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppInputEventRpcClient::PPP_InputEvent_HandleInputEvent(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ PP_Resource resource,
+ nacl_abi_size_t event_data_bytes, char* event_data,
+ nacl_abi_size_t character_text_bytes, char* character_text,
+ int32_t* handled) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_InputEvent_HandleInputEvent:iiCC:i",
+ instance,
+ resource,
+ event_data_bytes, event_data,
+ character_text_bytes, character_text,
+ handled
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppInstanceRpcClient::PPP_Instance_DidCreate(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ int32_t argc,
+ nacl_abi_size_t argn_bytes, char* argn,
+ nacl_abi_size_t argv_bytes, char* argv,
+ int32_t* success) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Instance_DidCreate:iiCC:i",
+ instance,
+ argc,
+ argn_bytes, argn,
+ argv_bytes, argv,
+ success
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppInstanceRpcClient::PPP_Instance_DidDestroy(
+ NaClSrpcChannel* channel,
+ PP_Instance instance) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Instance_DidDestroy:i:",
+ instance
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppInstanceRpcClient::PPP_Instance_DidChangeView(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ PP_Resource resource,
+ nacl_abi_size_t view_data_bytes, char* view_data) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Instance_DidChangeView:iiC:",
+ instance,
+ resource,
+ view_data_bytes, view_data
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppInstanceRpcClient::PPP_Instance_DidChangeFocus(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ bool has_focus) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Instance_DidChangeFocus:ib:",
+ instance,
+ has_focus
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppInstanceRpcClient::PPP_Instance_HandleDocumentLoad(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ PP_Resource url_loader,
+ int32_t* success) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Instance_HandleDocumentLoad:ii:i",
+ instance,
+ url_loader,
+ success
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppMessagingRpcClient::PPP_Messaging_HandleMessage(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ nacl_abi_size_t message_bytes, char* message) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Messaging_HandleMessage:iC:",
+ instance,
+ message_bytes, message
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppMouseLockRpcClient::PPP_MouseLock_MouseLockLost(
+ NaClSrpcChannel* channel,
+ PP_Instance instance) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_MouseLock_MouseLockLost:i:",
+ instance
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppPrintingRpcClient::PPP_Printing_QuerySupportedFormats(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ int32_t* formats) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Printing_QuerySupportedFormats:i:i",
+ instance,
+ formats
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppPrintingRpcClient::PPP_Printing_Begin(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ nacl_abi_size_t print_settings_bytes, char* print_settings,
+ int32_t* pages_required) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Printing_Begin:iC:i",
+ instance,
+ print_settings_bytes, print_settings,
+ pages_required
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppPrintingRpcClient::PPP_Printing_PrintPages(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ nacl_abi_size_t page_ranges_bytes, char* page_ranges,
+ int32_t page_range_count,
+ PP_Resource* image_data) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Printing_PrintPages:iCi:i",
+ instance,
+ page_ranges_bytes, page_ranges,
+ page_range_count,
+ image_data
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppPrintingRpcClient::PPP_Printing_End(
+ NaClSrpcChannel* channel,
+ PP_Instance instance) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Printing_End:i:",
+ instance
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppPrintingRpcClient::PPP_Printing_IsScalingDisabled(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ int32_t* result) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Printing_IsScalingDisabled:i:i",
+ instance,
+ result
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppScrollbarRpcClient::PPP_Scrollbar_ValueChanged(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ PP_Resource scrollbar,
+ int32_t value) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Scrollbar_ValueChanged:iii:",
+ instance,
+ scrollbar,
+ value
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppScrollbarRpcClient::PPP_Scrollbar_OverlayChanged(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ PP_Resource scrollbar,
+ int32_t overlay) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Scrollbar_OverlayChanged:iii:",
+ instance,
+ scrollbar,
+ overlay
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppSelectionRpcClient::PPP_Selection_GetSelectedText(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ int32_t html,
+ nacl_abi_size_t* selected_text_bytes, char* selected_text) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Selection_GetSelectedText:ii:C",
+ instance,
+ html,
+ selected_text_bytes, selected_text
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppWidgetRpcClient::PPP_Widget_Invalidate(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ PP_Resource widget,
+ nacl_abi_size_t dirty_rect_bytes, char* dirty_rect) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Widget_Invalidate:iiC:",
+ instance,
+ widget,
+ dirty_rect_bytes, dirty_rect
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+NaClSrpcError PppZoomRpcClient::PPP_Zoom_Zoom(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ double factor,
+ int32_t text_only) {
+ NaClSrpcError retval;
+ retval = NaClSrpcInvokeBySignature(
+ channel,
+ "PPP_Zoom_Zoom:idi:",
+ instance,
+ factor,
+ text_only
+ );
+ if (retval == NACL_SRPC_RESULT_INTERNAL)
+ ppapi_proxy::CleanUpAfterDeadNexe(instance);
+ return retval;
+}
+
+
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_server.cc index 4d0f962..e3e6798 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_server.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_server.cc @@ -1,457 +1,456 @@ -// Copyright (c) 2011 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. -// -// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING -// -// Automatically generated code. See srpcgen.py -// -// NaCl Simple Remote Procedure Call interface abstractions. - -#include "untrusted/srpcgen/ppp_rpc.h" -#ifdef __native_client__ -#ifndef UNREFERENCED_PARAMETER -#define UNREFERENCED_PARAMETER(P) do { (void) P; } while (0) -#endif // UNREFERENCED_PARAMETER -#else -#include "native_client/src/include/portability.h" -#endif // __native_client__ -#include "native_client/src/shared/srpc/nacl_srpc.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_module.h" -#include "ppapi/c/pp_resource.h" - -namespace { - -static void RunCompletionCallbackDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(outputs); - CompletionCallbackRpcServer::RunCompletionCallback( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.ival, - inputs[2]->u.count, inputs[2]->arrays.carr - ); -} - -static void PPP_InitializeModuleDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PppRpcServer::PPP_InitializeModule( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.ival, - inputs[2]->u.hval, - inputs[3]->arrays.str, - &(outputs[0]->u.ival), - &(outputs[1]->u.ival) - ); -} - -static void PPP_ShutdownModuleDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(inputs); - UNREFERENCED_PARAMETER(outputs); - PppRpcServer::PPP_ShutdownModule( - rpc, - done - ); -} - -static void PPP_GetInterfaceDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PppRpcServer::PPP_GetInterface( - rpc, - done, - inputs[0]->arrays.str, - &(outputs[0]->u.ival) - ); -} - -static void PPP_Audio_StreamCreatedDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(outputs); - PppAudioRpcServer::PPP_Audio_StreamCreated( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.hval, - inputs[2]->u.ival, - inputs[3]->u.hval - ); -} - -static void PPP_Find_StartFindDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PppFindRpcServer::PPP_Find_StartFind( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.count, inputs[1]->arrays.carr, - inputs[2]->u.ival, - &(outputs[0]->u.ival) - ); -} - -static void PPP_Find_SelectFindResultDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(outputs); - PppFindRpcServer::PPP_Find_SelectFindResult( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.ival - ); -} - -static void PPP_Find_StopFindDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(outputs); - PppFindRpcServer::PPP_Find_StopFind( - rpc, - done, - inputs[0]->u.ival - ); -} - -static void PPP_InputEvent_HandleInputEventDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PppInputEventRpcServer::PPP_InputEvent_HandleInputEvent( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.ival, - inputs[2]->u.count, inputs[2]->arrays.carr, - inputs[3]->u.count, inputs[3]->arrays.carr, - &(outputs[0]->u.ival) - ); -} - -static void PPP_Instance_DidCreateDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PppInstanceRpcServer::PPP_Instance_DidCreate( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.ival, - inputs[2]->u.count, inputs[2]->arrays.carr, - inputs[3]->u.count, inputs[3]->arrays.carr, - &(outputs[0]->u.ival) - ); -} - -static void PPP_Instance_DidDestroyDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(outputs); - PppInstanceRpcServer::PPP_Instance_DidDestroy( - rpc, - done, - inputs[0]->u.ival - ); -} - -static void PPP_Instance_DidChangeViewDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(outputs); - PppInstanceRpcServer::PPP_Instance_DidChangeView( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.count, inputs[1]->arrays.iarr, - inputs[2]->u.count, inputs[2]->arrays.iarr, - inputs[3]->u.ival - ); -} - -static void PPP_Instance_DidChangeFocusDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(outputs); - PppInstanceRpcServer::PPP_Instance_DidChangeFocus( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.bval - ); -} - -static void PPP_Instance_HandleDocumentLoadDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PppInstanceRpcServer::PPP_Instance_HandleDocumentLoad( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.ival, - &(outputs[0]->u.ival) - ); -} - -static void PPP_Messaging_HandleMessageDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(outputs); - PppMessagingRpcServer::PPP_Messaging_HandleMessage( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.count, inputs[1]->arrays.carr - ); -} - -static void PPP_MouseLock_MouseLockLostDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(outputs); - PppMouseLockRpcServer::PPP_MouseLock_MouseLockLost( - rpc, - done, - inputs[0]->u.ival - ); -} - -static void PPP_Printing_QuerySupportedFormatsDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PppPrintingRpcServer::PPP_Printing_QuerySupportedFormats( - rpc, - done, - inputs[0]->u.ival, - &(outputs[0]->u.ival) - ); -} - -static void PPP_Printing_BeginDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PppPrintingRpcServer::PPP_Printing_Begin( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.count, inputs[1]->arrays.carr, - &(outputs[0]->u.ival) - ); -} - -static void PPP_Printing_PrintPagesDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PppPrintingRpcServer::PPP_Printing_PrintPages( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.count, inputs[1]->arrays.carr, - inputs[2]->u.ival, - &(outputs[0]->u.ival) - ); -} - -static void PPP_Printing_EndDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(outputs); - PppPrintingRpcServer::PPP_Printing_End( - rpc, - done, - inputs[0]->u.ival - ); -} - -static void PPP_Printing_IsScalingDisabledDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PppPrintingRpcServer::PPP_Printing_IsScalingDisabled( - rpc, - done, - inputs[0]->u.ival, - &(outputs[0]->u.ival) - ); -} - -static void PPP_Scrollbar_ValueChangedDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(outputs); - PppScrollbarRpcServer::PPP_Scrollbar_ValueChanged( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.ival, - inputs[2]->u.ival - ); -} - -static void PPP_Scrollbar_OverlayChangedDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(outputs); - PppScrollbarRpcServer::PPP_Scrollbar_OverlayChanged( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.ival, - inputs[2]->u.ival - ); -} - -static void PPP_Selection_GetSelectedTextDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PppSelectionRpcServer::PPP_Selection_GetSelectedText( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.ival, - &(outputs[0]->u.count), outputs[0]->arrays.carr - ); -} - -static void PPP_Widget_InvalidateDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(outputs); - PppWidgetRpcServer::PPP_Widget_Invalidate( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.ival, - inputs[2]->u.count, inputs[2]->arrays.carr - ); -} - -static void PPP_Zoom_ZoomDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - UNREFERENCED_PARAMETER(outputs); - PppZoomRpcServer::PPP_Zoom_Zoom( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.dval, - inputs[2]->u.ival - ); -} - -} // namespace - -NaClSrpcHandlerDesc PppRpcs::srpc_methods[] = { - { "RunCompletionCallback:iiC:", RunCompletionCallbackDispatcher }, - { "PPP_InitializeModule:iihs:ii", PPP_InitializeModuleDispatcher }, - { "PPP_ShutdownModule::", PPP_ShutdownModuleDispatcher }, - { "PPP_GetInterface:s:i", PPP_GetInterfaceDispatcher }, - { "PPP_Audio_StreamCreated:ihih:", PPP_Audio_StreamCreatedDispatcher }, - { "PPP_Find_StartFind:iCi:i", PPP_Find_StartFindDispatcher }, - { "PPP_Find_SelectFindResult:ii:", PPP_Find_SelectFindResultDispatcher }, - { "PPP_Find_StopFind:i:", PPP_Find_StopFindDispatcher }, - { "PPP_InputEvent_HandleInputEvent:iiCC:i", PPP_InputEvent_HandleInputEventDispatcher }, - { "PPP_Instance_DidCreate:iiCC:i", PPP_Instance_DidCreateDispatcher }, - { "PPP_Instance_DidDestroy:i:", PPP_Instance_DidDestroyDispatcher }, - { "PPP_Instance_DidChangeView:iIIi:", PPP_Instance_DidChangeViewDispatcher }, - { "PPP_Instance_DidChangeFocus:ib:", PPP_Instance_DidChangeFocusDispatcher }, - { "PPP_Instance_HandleDocumentLoad:ii:i", PPP_Instance_HandleDocumentLoadDispatcher }, - { "PPP_Messaging_HandleMessage:iC:", PPP_Messaging_HandleMessageDispatcher }, - { "PPP_MouseLock_MouseLockLost:i:", PPP_MouseLock_MouseLockLostDispatcher }, - { "PPP_Printing_QuerySupportedFormats:i:i", PPP_Printing_QuerySupportedFormatsDispatcher }, - { "PPP_Printing_Begin:iC:i", PPP_Printing_BeginDispatcher }, - { "PPP_Printing_PrintPages:iCi:i", PPP_Printing_PrintPagesDispatcher }, - { "PPP_Printing_End:i:", PPP_Printing_EndDispatcher }, - { "PPP_Printing_IsScalingDisabled:i:i", PPP_Printing_IsScalingDisabledDispatcher }, - { "PPP_Scrollbar_ValueChanged:iii:", PPP_Scrollbar_ValueChangedDispatcher }, - { "PPP_Scrollbar_OverlayChanged:iii:", PPP_Scrollbar_OverlayChangedDispatcher }, - { "PPP_Selection_GetSelectedText:ii:C", PPP_Selection_GetSelectedTextDispatcher }, - { "PPP_Widget_Invalidate:iiC:", PPP_Widget_InvalidateDispatcher }, - { "PPP_Zoom_Zoom:idi:", PPP_Zoom_ZoomDispatcher }, - { NULL, NULL } -}; - +// Copyright (c) 2011 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.
+//
+// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+//
+// Automatically generated code. See srpcgen.py
+//
+// NaCl Simple Remote Procedure Call interface abstractions.
+
+#include "untrusted/srpcgen/ppp_rpc.h"
+#ifdef __native_client__
+#ifndef UNREFERENCED_PARAMETER
+#define UNREFERENCED_PARAMETER(P) do { (void) P; } while (0)
+#endif // UNREFERENCED_PARAMETER
+#else
+#include "native_client/src/include/portability.h"
+#endif // __native_client__
+#include "native_client/src/shared/srpc/nacl_srpc.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_module.h"
+#include "ppapi/c/pp_resource.h"
+
+namespace {
+
+static void RunCompletionCallbackDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(outputs);
+ CompletionCallbackRpcServer::RunCompletionCallback(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.ival,
+ inputs[2]->u.count, inputs[2]->arrays.carr
+ );
+}
+
+static void PPP_InitializeModuleDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ PppRpcServer::PPP_InitializeModule(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.ival,
+ inputs[2]->u.hval,
+ inputs[3]->arrays.str,
+ &(outputs[0]->u.ival),
+ &(outputs[1]->u.ival)
+ );
+}
+
+static void PPP_ShutdownModuleDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(inputs);
+ UNREFERENCED_PARAMETER(outputs);
+ PppRpcServer::PPP_ShutdownModule(
+ rpc,
+ done
+ );
+}
+
+static void PPP_GetInterfaceDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ PppRpcServer::PPP_GetInterface(
+ rpc,
+ done,
+ inputs[0]->arrays.str,
+ &(outputs[0]->u.ival)
+ );
+}
+
+static void PPP_Audio_StreamCreatedDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(outputs);
+ PppAudioRpcServer::PPP_Audio_StreamCreated(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.hval,
+ inputs[2]->u.ival,
+ inputs[3]->u.hval
+ );
+}
+
+static void PPP_Find_StartFindDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ PppFindRpcServer::PPP_Find_StartFind(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.count, inputs[1]->arrays.carr,
+ inputs[2]->u.ival,
+ &(outputs[0]->u.ival)
+ );
+}
+
+static void PPP_Find_SelectFindResultDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(outputs);
+ PppFindRpcServer::PPP_Find_SelectFindResult(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.ival
+ );
+}
+
+static void PPP_Find_StopFindDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(outputs);
+ PppFindRpcServer::PPP_Find_StopFind(
+ rpc,
+ done,
+ inputs[0]->u.ival
+ );
+}
+
+static void PPP_InputEvent_HandleInputEventDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ PppInputEventRpcServer::PPP_InputEvent_HandleInputEvent(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.ival,
+ inputs[2]->u.count, inputs[2]->arrays.carr,
+ inputs[3]->u.count, inputs[3]->arrays.carr,
+ &(outputs[0]->u.ival)
+ );
+}
+
+static void PPP_Instance_DidCreateDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ PppInstanceRpcServer::PPP_Instance_DidCreate(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.ival,
+ inputs[2]->u.count, inputs[2]->arrays.carr,
+ inputs[3]->u.count, inputs[3]->arrays.carr,
+ &(outputs[0]->u.ival)
+ );
+}
+
+static void PPP_Instance_DidDestroyDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(outputs);
+ PppInstanceRpcServer::PPP_Instance_DidDestroy(
+ rpc,
+ done,
+ inputs[0]->u.ival
+ );
+}
+
+static void PPP_Instance_DidChangeViewDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(outputs);
+ PppInstanceRpcServer::PPP_Instance_DidChangeView(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.ival,
+ inputs[2]->u.count, inputs[2]->arrays.carr
+ );
+}
+
+static void PPP_Instance_DidChangeFocusDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(outputs);
+ PppInstanceRpcServer::PPP_Instance_DidChangeFocus(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.bval
+ );
+}
+
+static void PPP_Instance_HandleDocumentLoadDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ PppInstanceRpcServer::PPP_Instance_HandleDocumentLoad(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.ival,
+ &(outputs[0]->u.ival)
+ );
+}
+
+static void PPP_Messaging_HandleMessageDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(outputs);
+ PppMessagingRpcServer::PPP_Messaging_HandleMessage(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.count, inputs[1]->arrays.carr
+ );
+}
+
+static void PPP_MouseLock_MouseLockLostDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(outputs);
+ PppMouseLockRpcServer::PPP_MouseLock_MouseLockLost(
+ rpc,
+ done,
+ inputs[0]->u.ival
+ );
+}
+
+static void PPP_Printing_QuerySupportedFormatsDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ PppPrintingRpcServer::PPP_Printing_QuerySupportedFormats(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ &(outputs[0]->u.ival)
+ );
+}
+
+static void PPP_Printing_BeginDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ PppPrintingRpcServer::PPP_Printing_Begin(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.count, inputs[1]->arrays.carr,
+ &(outputs[0]->u.ival)
+ );
+}
+
+static void PPP_Printing_PrintPagesDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ PppPrintingRpcServer::PPP_Printing_PrintPages(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.count, inputs[1]->arrays.carr,
+ inputs[2]->u.ival,
+ &(outputs[0]->u.ival)
+ );
+}
+
+static void PPP_Printing_EndDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(outputs);
+ PppPrintingRpcServer::PPP_Printing_End(
+ rpc,
+ done,
+ inputs[0]->u.ival
+ );
+}
+
+static void PPP_Printing_IsScalingDisabledDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ PppPrintingRpcServer::PPP_Printing_IsScalingDisabled(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ &(outputs[0]->u.ival)
+ );
+}
+
+static void PPP_Scrollbar_ValueChangedDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(outputs);
+ PppScrollbarRpcServer::PPP_Scrollbar_ValueChanged(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.ival,
+ inputs[2]->u.ival
+ );
+}
+
+static void PPP_Scrollbar_OverlayChangedDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(outputs);
+ PppScrollbarRpcServer::PPP_Scrollbar_OverlayChanged(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.ival,
+ inputs[2]->u.ival
+ );
+}
+
+static void PPP_Selection_GetSelectedTextDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ PppSelectionRpcServer::PPP_Selection_GetSelectedText(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.ival,
+ &(outputs[0]->u.count), outputs[0]->arrays.carr
+ );
+}
+
+static void PPP_Widget_InvalidateDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(outputs);
+ PppWidgetRpcServer::PPP_Widget_Invalidate(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.ival,
+ inputs[2]->u.count, inputs[2]->arrays.carr
+ );
+}
+
+static void PPP_Zoom_ZoomDispatcher(
+ NaClSrpcRpc* rpc,
+ NaClSrpcArg** inputs,
+ NaClSrpcArg** outputs,
+ NaClSrpcClosure* done
+) {
+ UNREFERENCED_PARAMETER(outputs);
+ PppZoomRpcServer::PPP_Zoom_Zoom(
+ rpc,
+ done,
+ inputs[0]->u.ival,
+ inputs[1]->u.dval,
+ inputs[2]->u.ival
+ );
+}
+
+} // namespace
+
+NaClSrpcHandlerDesc PppRpcs::srpc_methods[] = {
+ { "RunCompletionCallback:iiC:", RunCompletionCallbackDispatcher },
+ { "PPP_InitializeModule:iihs:ii", PPP_InitializeModuleDispatcher },
+ { "PPP_ShutdownModule::", PPP_ShutdownModuleDispatcher },
+ { "PPP_GetInterface:s:i", PPP_GetInterfaceDispatcher },
+ { "PPP_Audio_StreamCreated:ihih:", PPP_Audio_StreamCreatedDispatcher },
+ { "PPP_Find_StartFind:iCi:i", PPP_Find_StartFindDispatcher },
+ { "PPP_Find_SelectFindResult:ii:", PPP_Find_SelectFindResultDispatcher },
+ { "PPP_Find_StopFind:i:", PPP_Find_StopFindDispatcher },
+ { "PPP_InputEvent_HandleInputEvent:iiCC:i", PPP_InputEvent_HandleInputEventDispatcher },
+ { "PPP_Instance_DidCreate:iiCC:i", PPP_Instance_DidCreateDispatcher },
+ { "PPP_Instance_DidDestroy:i:", PPP_Instance_DidDestroyDispatcher },
+ { "PPP_Instance_DidChangeView:iiC:", PPP_Instance_DidChangeViewDispatcher },
+ { "PPP_Instance_DidChangeFocus:ib:", PPP_Instance_DidChangeFocusDispatcher },
+ { "PPP_Instance_HandleDocumentLoad:ii:i", PPP_Instance_HandleDocumentLoadDispatcher },
+ { "PPP_Messaging_HandleMessage:iC:", PPP_Messaging_HandleMessageDispatcher },
+ { "PPP_MouseLock_MouseLockLost:i:", PPP_MouseLock_MouseLockLostDispatcher },
+ { "PPP_Printing_QuerySupportedFormats:i:i", PPP_Printing_QuerySupportedFormatsDispatcher },
+ { "PPP_Printing_Begin:iC:i", PPP_Printing_BeginDispatcher },
+ { "PPP_Printing_PrintPages:iCi:i", PPP_Printing_PrintPagesDispatcher },
+ { "PPP_Printing_End:i:", PPP_Printing_EndDispatcher },
+ { "PPP_Printing_IsScalingDisabled:i:i", PPP_Printing_IsScalingDisabledDispatcher },
+ { "PPP_Scrollbar_ValueChanged:iii:", PPP_Scrollbar_ValueChangedDispatcher },
+ { "PPP_Scrollbar_OverlayChanged:iii:", PPP_Scrollbar_OverlayChangedDispatcher },
+ { "PPP_Selection_GetSelectedText:ii:C", PPP_Selection_GetSelectedTextDispatcher },
+ { "PPP_Widget_Invalidate:iiC:", PPP_Widget_InvalidateDispatcher },
+ { "PPP_Zoom_Zoom:idi:", PPP_Zoom_ZoomDispatcher },
+ { NULL, NULL }
+};
+
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h b/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h index 20782a8..1c62a3b 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h @@ -1,267 +1,266 @@ -// Copyright (c) 2011 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. -// -// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING -// -// Automatically generated code. See srpcgen.py -// -// NaCl Simple Remote Procedure Call interface abstractions. - -#ifndef GEN_PPAPI_PROXY_PPP_RPC_H_ -#define GEN_PPAPI_PROXY_PPP_RPC_H_ - -#ifndef __native_client__ -#include "native_client/src/include/portability.h" -#endif // __native_client__ -#include "native_client/src/shared/srpc/nacl_srpc.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_module.h" -#include "ppapi/c/pp_resource.h" - -class CompletionCallbackRpcClient { - public: - static NaClSrpcError RunCompletionCallback( - NaClSrpcChannel* channel, - int32_t callback_id, - int32_t result, - nacl_abi_size_t read_buffer_bytes, char* read_buffer); - - private: - CompletionCallbackRpcClient(); - CompletionCallbackRpcClient(const CompletionCallbackRpcClient&); - void operator=(const CompletionCallbackRpcClient); -}; // class CompletionCallbackRpcClient - -class PppRpcClient { - public: - static NaClSrpcError PPP_InitializeModule( - NaClSrpcChannel* channel, - int32_t pid, - PP_Module module, - NaClSrpcImcDescType upcall_channel_desc, - char* service_description, - int32_t* nacl_pid, - int32_t* success); - static NaClSrpcError PPP_ShutdownModule( - NaClSrpcChannel* channel); - static NaClSrpcError PPP_GetInterface( - NaClSrpcChannel* channel, - char* interface_name, - int32_t* exports_interface_name); - - private: - PppRpcClient(); - PppRpcClient(const PppRpcClient&); - void operator=(const PppRpcClient); -}; // class PppRpcClient - -class PppAudioRpcClient { - public: - static NaClSrpcError PPP_Audio_StreamCreated( - NaClSrpcChannel* channel, - PP_Instance instance, - NaClSrpcImcDescType out_shm, - int32_t out_shm_size, - NaClSrpcImcDescType out_socket); - - private: - PppAudioRpcClient(); - PppAudioRpcClient(const PppAudioRpcClient&); - void operator=(const PppAudioRpcClient); -}; // class PppAudioRpcClient - -class PppFindRpcClient { - public: - static NaClSrpcError PPP_Find_StartFind( - NaClSrpcChannel* channel, - PP_Instance instance, - nacl_abi_size_t text_bytes, char* text, - int32_t case_sensitive, - int32_t* supports_find); - static NaClSrpcError PPP_Find_SelectFindResult( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t forward); - static NaClSrpcError PPP_Find_StopFind( - NaClSrpcChannel* channel, - PP_Instance instance); - - private: - PppFindRpcClient(); - PppFindRpcClient(const PppFindRpcClient&); - void operator=(const PppFindRpcClient); -}; // class PppFindRpcClient - -class PppInputEventRpcClient { - public: - static NaClSrpcError PPP_InputEvent_HandleInputEvent( - NaClSrpcChannel* channel, - PP_Instance instance, - PP_Resource resource, - nacl_abi_size_t event_data_bytes, char* event_data, - nacl_abi_size_t character_text_bytes, char* character_text, - int32_t* handled); - - private: - PppInputEventRpcClient(); - PppInputEventRpcClient(const PppInputEventRpcClient&); - void operator=(const PppInputEventRpcClient); -}; // class PppInputEventRpcClient - -class PppInstanceRpcClient { - public: - static NaClSrpcError PPP_Instance_DidCreate( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t argc, - nacl_abi_size_t argn_bytes, char* argn, - nacl_abi_size_t argv_bytes, char* argv, - int32_t* success); - static NaClSrpcError PPP_Instance_DidDestroy( - NaClSrpcChannel* channel, - PP_Instance instance); - static NaClSrpcError PPP_Instance_DidChangeView( - NaClSrpcChannel* channel, - PP_Instance instance, - nacl_abi_size_t position_bytes, int32_t* position, - nacl_abi_size_t clip_bytes, int32_t* clip, - int32_t is_fullscreen); - static NaClSrpcError PPP_Instance_DidChangeFocus( - NaClSrpcChannel* channel, - PP_Instance instance, - bool has_focus); - static NaClSrpcError PPP_Instance_HandleDocumentLoad( - NaClSrpcChannel* channel, - PP_Instance instance, - PP_Resource url_loader, - int32_t* success); - - private: - PppInstanceRpcClient(); - PppInstanceRpcClient(const PppInstanceRpcClient&); - void operator=(const PppInstanceRpcClient); -}; // class PppInstanceRpcClient - -class PppMessagingRpcClient { - public: - static NaClSrpcError PPP_Messaging_HandleMessage( - NaClSrpcChannel* channel, - PP_Instance instance, - nacl_abi_size_t message_bytes, char* message); - - private: - PppMessagingRpcClient(); - PppMessagingRpcClient(const PppMessagingRpcClient&); - void operator=(const PppMessagingRpcClient); -}; // class PppMessagingRpcClient - -class PppMouseLockRpcClient { - public: - static NaClSrpcError PPP_MouseLock_MouseLockLost( - NaClSrpcChannel* channel, - PP_Instance instance); - - private: - PppMouseLockRpcClient(); - PppMouseLockRpcClient(const PppMouseLockRpcClient&); - void operator=(const PppMouseLockRpcClient); -}; // class PppMouseLockRpcClient - -class PppPrintingRpcClient { - public: - static NaClSrpcError PPP_Printing_QuerySupportedFormats( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t* formats); - static NaClSrpcError PPP_Printing_Begin( - NaClSrpcChannel* channel, - PP_Instance instance, - nacl_abi_size_t print_settings_bytes, char* print_settings, - int32_t* pages_required); - static NaClSrpcError PPP_Printing_PrintPages( - NaClSrpcChannel* channel, - PP_Instance instance, - nacl_abi_size_t page_ranges_bytes, char* page_ranges, - int32_t page_range_count, - PP_Resource* image_data); - static NaClSrpcError PPP_Printing_End( - NaClSrpcChannel* channel, - PP_Instance instance); - static NaClSrpcError PPP_Printing_IsScalingDisabled( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t* result); - - private: - PppPrintingRpcClient(); - PppPrintingRpcClient(const PppPrintingRpcClient&); - void operator=(const PppPrintingRpcClient); -}; // class PppPrintingRpcClient - -class PppScrollbarRpcClient { - public: - static NaClSrpcError PPP_Scrollbar_ValueChanged( - NaClSrpcChannel* channel, - PP_Instance instance, - PP_Resource scrollbar, - int32_t value); - static NaClSrpcError PPP_Scrollbar_OverlayChanged( - NaClSrpcChannel* channel, - PP_Instance instance, - PP_Resource scrollbar, - int32_t overlay); - - private: - PppScrollbarRpcClient(); - PppScrollbarRpcClient(const PppScrollbarRpcClient&); - void operator=(const PppScrollbarRpcClient); -}; // class PppScrollbarRpcClient - -class PppSelectionRpcClient { - public: - static NaClSrpcError PPP_Selection_GetSelectedText( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t html, - nacl_abi_size_t* selected_text_bytes, char* selected_text); - - private: - PppSelectionRpcClient(); - PppSelectionRpcClient(const PppSelectionRpcClient&); - void operator=(const PppSelectionRpcClient); -}; // class PppSelectionRpcClient - -class PppWidgetRpcClient { - public: - static NaClSrpcError PPP_Widget_Invalidate( - NaClSrpcChannel* channel, - PP_Instance instance, - PP_Resource widget, - nacl_abi_size_t dirty_rect_bytes, char* dirty_rect); - - private: - PppWidgetRpcClient(); - PppWidgetRpcClient(const PppWidgetRpcClient&); - void operator=(const PppWidgetRpcClient); -}; // class PppWidgetRpcClient - -class PppZoomRpcClient { - public: - static NaClSrpcError PPP_Zoom_Zoom( - NaClSrpcChannel* channel, - PP_Instance instance, - double factor, - int32_t text_only); - - private: - PppZoomRpcClient(); - PppZoomRpcClient(const PppZoomRpcClient&); - void operator=(const PppZoomRpcClient); -}; // class PppZoomRpcClient - - - - -#endif // GEN_PPAPI_PROXY_PPP_RPC_H_ - +// Copyright (c) 2011 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.
+//
+// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+//
+// Automatically generated code. See srpcgen.py
+//
+// NaCl Simple Remote Procedure Call interface abstractions.
+
+#ifndef GEN_PPAPI_PROXY_PPP_RPC_H_
+#define GEN_PPAPI_PROXY_PPP_RPC_H_
+
+#ifndef __native_client__
+#include "native_client/src/include/portability.h"
+#endif // __native_client__
+#include "native_client/src/shared/srpc/nacl_srpc.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_module.h"
+#include "ppapi/c/pp_resource.h"
+
+class CompletionCallbackRpcClient {
+ public:
+ static NaClSrpcError RunCompletionCallback(
+ NaClSrpcChannel* channel,
+ int32_t callback_id,
+ int32_t result,
+ nacl_abi_size_t read_buffer_bytes, char* read_buffer);
+
+ private:
+ CompletionCallbackRpcClient();
+ CompletionCallbackRpcClient(const CompletionCallbackRpcClient&);
+ void operator=(const CompletionCallbackRpcClient);
+}; // class CompletionCallbackRpcClient
+
+class PppRpcClient {
+ public:
+ static NaClSrpcError PPP_InitializeModule(
+ NaClSrpcChannel* channel,
+ int32_t pid,
+ PP_Module module,
+ NaClSrpcImcDescType upcall_channel_desc,
+ char* service_description,
+ int32_t* nacl_pid,
+ int32_t* success);
+ static NaClSrpcError PPP_ShutdownModule(
+ NaClSrpcChannel* channel);
+ static NaClSrpcError PPP_GetInterface(
+ NaClSrpcChannel* channel,
+ char* interface_name,
+ int32_t* exports_interface_name);
+
+ private:
+ PppRpcClient();
+ PppRpcClient(const PppRpcClient&);
+ void operator=(const PppRpcClient);
+}; // class PppRpcClient
+
+class PppAudioRpcClient {
+ public:
+ static NaClSrpcError PPP_Audio_StreamCreated(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ NaClSrpcImcDescType out_shm,
+ int32_t out_shm_size,
+ NaClSrpcImcDescType out_socket);
+
+ private:
+ PppAudioRpcClient();
+ PppAudioRpcClient(const PppAudioRpcClient&);
+ void operator=(const PppAudioRpcClient);
+}; // class PppAudioRpcClient
+
+class PppFindRpcClient {
+ public:
+ static NaClSrpcError PPP_Find_StartFind(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ nacl_abi_size_t text_bytes, char* text,
+ int32_t case_sensitive,
+ int32_t* supports_find);
+ static NaClSrpcError PPP_Find_SelectFindResult(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ int32_t forward);
+ static NaClSrpcError PPP_Find_StopFind(
+ NaClSrpcChannel* channel,
+ PP_Instance instance);
+
+ private:
+ PppFindRpcClient();
+ PppFindRpcClient(const PppFindRpcClient&);
+ void operator=(const PppFindRpcClient);
+}; // class PppFindRpcClient
+
+class PppInputEventRpcClient {
+ public:
+ static NaClSrpcError PPP_InputEvent_HandleInputEvent(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ PP_Resource resource,
+ nacl_abi_size_t event_data_bytes, char* event_data,
+ nacl_abi_size_t character_text_bytes, char* character_text,
+ int32_t* handled);
+
+ private:
+ PppInputEventRpcClient();
+ PppInputEventRpcClient(const PppInputEventRpcClient&);
+ void operator=(const PppInputEventRpcClient);
+}; // class PppInputEventRpcClient
+
+class PppInstanceRpcClient {
+ public:
+ static NaClSrpcError PPP_Instance_DidCreate(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ int32_t argc,
+ nacl_abi_size_t argn_bytes, char* argn,
+ nacl_abi_size_t argv_bytes, char* argv,
+ int32_t* success);
+ static NaClSrpcError PPP_Instance_DidDestroy(
+ NaClSrpcChannel* channel,
+ PP_Instance instance);
+ static NaClSrpcError PPP_Instance_DidChangeView(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ PP_Resource resource,
+ nacl_abi_size_t view_data_bytes, char* view_data);
+ static NaClSrpcError PPP_Instance_DidChangeFocus(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ bool has_focus);
+ static NaClSrpcError PPP_Instance_HandleDocumentLoad(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ PP_Resource url_loader,
+ int32_t* success);
+
+ private:
+ PppInstanceRpcClient();
+ PppInstanceRpcClient(const PppInstanceRpcClient&);
+ void operator=(const PppInstanceRpcClient);
+}; // class PppInstanceRpcClient
+
+class PppMessagingRpcClient {
+ public:
+ static NaClSrpcError PPP_Messaging_HandleMessage(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ nacl_abi_size_t message_bytes, char* message);
+
+ private:
+ PppMessagingRpcClient();
+ PppMessagingRpcClient(const PppMessagingRpcClient&);
+ void operator=(const PppMessagingRpcClient);
+}; // class PppMessagingRpcClient
+
+class PppMouseLockRpcClient {
+ public:
+ static NaClSrpcError PPP_MouseLock_MouseLockLost(
+ NaClSrpcChannel* channel,
+ PP_Instance instance);
+
+ private:
+ PppMouseLockRpcClient();
+ PppMouseLockRpcClient(const PppMouseLockRpcClient&);
+ void operator=(const PppMouseLockRpcClient);
+}; // class PppMouseLockRpcClient
+
+class PppPrintingRpcClient {
+ public:
+ static NaClSrpcError PPP_Printing_QuerySupportedFormats(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ int32_t* formats);
+ static NaClSrpcError PPP_Printing_Begin(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ nacl_abi_size_t print_settings_bytes, char* print_settings,
+ int32_t* pages_required);
+ static NaClSrpcError PPP_Printing_PrintPages(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ nacl_abi_size_t page_ranges_bytes, char* page_ranges,
+ int32_t page_range_count,
+ PP_Resource* image_data);
+ static NaClSrpcError PPP_Printing_End(
+ NaClSrpcChannel* channel,
+ PP_Instance instance);
+ static NaClSrpcError PPP_Printing_IsScalingDisabled(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ int32_t* result);
+
+ private:
+ PppPrintingRpcClient();
+ PppPrintingRpcClient(const PppPrintingRpcClient&);
+ void operator=(const PppPrintingRpcClient);
+}; // class PppPrintingRpcClient
+
+class PppScrollbarRpcClient {
+ public:
+ static NaClSrpcError PPP_Scrollbar_ValueChanged(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ PP_Resource scrollbar,
+ int32_t value);
+ static NaClSrpcError PPP_Scrollbar_OverlayChanged(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ PP_Resource scrollbar,
+ int32_t overlay);
+
+ private:
+ PppScrollbarRpcClient();
+ PppScrollbarRpcClient(const PppScrollbarRpcClient&);
+ void operator=(const PppScrollbarRpcClient);
+}; // class PppScrollbarRpcClient
+
+class PppSelectionRpcClient {
+ public:
+ static NaClSrpcError PPP_Selection_GetSelectedText(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ int32_t html,
+ nacl_abi_size_t* selected_text_bytes, char* selected_text);
+
+ private:
+ PppSelectionRpcClient();
+ PppSelectionRpcClient(const PppSelectionRpcClient&);
+ void operator=(const PppSelectionRpcClient);
+}; // class PppSelectionRpcClient
+
+class PppWidgetRpcClient {
+ public:
+ static NaClSrpcError PPP_Widget_Invalidate(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ PP_Resource widget,
+ nacl_abi_size_t dirty_rect_bytes, char* dirty_rect);
+
+ private:
+ PppWidgetRpcClient();
+ PppWidgetRpcClient(const PppWidgetRpcClient&);
+ void operator=(const PppWidgetRpcClient);
+}; // class PppWidgetRpcClient
+
+class PppZoomRpcClient {
+ public:
+ static NaClSrpcError PPP_Zoom_Zoom(
+ NaClSrpcChannel* channel,
+ PP_Instance instance,
+ double factor,
+ int32_t text_only);
+
+ private:
+ PppZoomRpcClient();
+ PppZoomRpcClient(const PppZoomRpcClient&);
+ void operator=(const PppZoomRpcClient);
+}; // class PppZoomRpcClient
+
+
+
+
+#endif // GEN_PPAPI_PROXY_PPP_RPC_H_
+
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h b/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h index 770447f..daa01f3 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h @@ -1,296 +1,295 @@ -// Copyright (c) 2011 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. -// -// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING -// -// Automatically generated code. See srpcgen.py -// -// NaCl Simple Remote Procedure Call interface abstractions. - -#ifndef GEN_PPAPI_PROXY_PPP_RPC_H_ -#define GEN_PPAPI_PROXY_PPP_RPC_H_ - -#ifndef __native_client__ -#include "native_client/src/include/portability.h" -#endif // __native_client__ -#include "native_client/src/shared/srpc/nacl_srpc.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_module.h" -#include "ppapi/c/pp_resource.h" - -class CompletionCallbackRpcServer { - public: - static void RunCompletionCallback( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - int32_t callback_id, - int32_t result, - nacl_abi_size_t read_buffer_bytes, char* read_buffer); - - private: - CompletionCallbackRpcServer(); - CompletionCallbackRpcServer(const CompletionCallbackRpcServer&); - void operator=(const CompletionCallbackRpcServer); -}; // class CompletionCallbackRpcServer - -class PppRpcServer { - public: - static void PPP_InitializeModule( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - int32_t pid, - PP_Module module, - NaClSrpcImcDescType upcall_channel_desc, - char* service_description, - int32_t* nacl_pid, - int32_t* success); - static void PPP_ShutdownModule( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done); - static void PPP_GetInterface( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - char* interface_name, - int32_t* exports_interface_name); - - private: - PppRpcServer(); - PppRpcServer(const PppRpcServer&); - void operator=(const PppRpcServer); -}; // class PppRpcServer - -class PppAudioRpcServer { - public: - static void PPP_Audio_StreamCreated( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - NaClSrpcImcDescType out_shm, - int32_t out_shm_size, - NaClSrpcImcDescType out_socket); - - private: - PppAudioRpcServer(); - PppAudioRpcServer(const PppAudioRpcServer&); - void operator=(const PppAudioRpcServer); -}; // class PppAudioRpcServer - -class PppFindRpcServer { - public: - static void PPP_Find_StartFind( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - nacl_abi_size_t text_bytes, char* text, - int32_t case_sensitive, - int32_t* supports_find); - static void PPP_Find_SelectFindResult( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t forward); - static void PPP_Find_StopFind( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance); - - private: - PppFindRpcServer(); - PppFindRpcServer(const PppFindRpcServer&); - void operator=(const PppFindRpcServer); -}; // class PppFindRpcServer - -class PppInputEventRpcServer { - public: - static void PPP_InputEvent_HandleInputEvent( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - PP_Resource resource, - nacl_abi_size_t event_data_bytes, char* event_data, - nacl_abi_size_t character_text_bytes, char* character_text, - int32_t* handled); - - private: - PppInputEventRpcServer(); - PppInputEventRpcServer(const PppInputEventRpcServer&); - void operator=(const PppInputEventRpcServer); -}; // class PppInputEventRpcServer - -class PppInstanceRpcServer { - public: - static void PPP_Instance_DidCreate( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t argc, - nacl_abi_size_t argn_bytes, char* argn, - nacl_abi_size_t argv_bytes, char* argv, - int32_t* success); - static void PPP_Instance_DidDestroy( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance); - static void PPP_Instance_DidChangeView( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - nacl_abi_size_t position_bytes, int32_t* position, - nacl_abi_size_t clip_bytes, int32_t* clip, - int32_t is_fullscreen); - static void PPP_Instance_DidChangeFocus( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - bool has_focus); - static void PPP_Instance_HandleDocumentLoad( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - PP_Resource url_loader, - int32_t* success); - - private: - PppInstanceRpcServer(); - PppInstanceRpcServer(const PppInstanceRpcServer&); - void operator=(const PppInstanceRpcServer); -}; // class PppInstanceRpcServer - -class PppMessagingRpcServer { - public: - static void PPP_Messaging_HandleMessage( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - nacl_abi_size_t message_bytes, char* message); - - private: - PppMessagingRpcServer(); - PppMessagingRpcServer(const PppMessagingRpcServer&); - void operator=(const PppMessagingRpcServer); -}; // class PppMessagingRpcServer - -class PppMouseLockRpcServer { - public: - static void PPP_MouseLock_MouseLockLost( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance); - - private: - PppMouseLockRpcServer(); - PppMouseLockRpcServer(const PppMouseLockRpcServer&); - void operator=(const PppMouseLockRpcServer); -}; // class PppMouseLockRpcServer - -class PppPrintingRpcServer { - public: - static void PPP_Printing_QuerySupportedFormats( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t* formats); - static void PPP_Printing_Begin( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - nacl_abi_size_t print_settings_bytes, char* print_settings, - int32_t* pages_required); - static void PPP_Printing_PrintPages( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - nacl_abi_size_t page_ranges_bytes, char* page_ranges, - int32_t page_range_count, - PP_Resource* image_data); - static void PPP_Printing_End( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance); - static void PPP_Printing_IsScalingDisabled( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t* result); - - private: - PppPrintingRpcServer(); - PppPrintingRpcServer(const PppPrintingRpcServer&); - void operator=(const PppPrintingRpcServer); -}; // class PppPrintingRpcServer - -class PppScrollbarRpcServer { - public: - static void PPP_Scrollbar_ValueChanged( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - PP_Resource scrollbar, - int32_t value); - static void PPP_Scrollbar_OverlayChanged( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - PP_Resource scrollbar, - int32_t overlay); - - private: - PppScrollbarRpcServer(); - PppScrollbarRpcServer(const PppScrollbarRpcServer&); - void operator=(const PppScrollbarRpcServer); -}; // class PppScrollbarRpcServer - -class PppSelectionRpcServer { - public: - static void PPP_Selection_GetSelectedText( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t html, - nacl_abi_size_t* selected_text_bytes, char* selected_text); - - private: - PppSelectionRpcServer(); - PppSelectionRpcServer(const PppSelectionRpcServer&); - void operator=(const PppSelectionRpcServer); -}; // class PppSelectionRpcServer - -class PppWidgetRpcServer { - public: - static void PPP_Widget_Invalidate( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - PP_Resource widget, - nacl_abi_size_t dirty_rect_bytes, char* dirty_rect); - - private: - PppWidgetRpcServer(); - PppWidgetRpcServer(const PppWidgetRpcServer&); - void operator=(const PppWidgetRpcServer); -}; // class PppWidgetRpcServer - -class PppZoomRpcServer { - public: - static void PPP_Zoom_Zoom( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - double factor, - int32_t text_only); - - private: - PppZoomRpcServer(); - PppZoomRpcServer(const PppZoomRpcServer&); - void operator=(const PppZoomRpcServer); -}; // class PppZoomRpcServer - -class PppRpcs { - public: - static NaClSrpcHandlerDesc srpc_methods[]; -}; // class PppRpcs - - -#endif // GEN_PPAPI_PROXY_PPP_RPC_H_ - +// Copyright (c) 2011 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.
+//
+// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+//
+// Automatically generated code. See srpcgen.py
+//
+// NaCl Simple Remote Procedure Call interface abstractions.
+
+#ifndef GEN_PPAPI_PROXY_PPP_RPC_H_
+#define GEN_PPAPI_PROXY_PPP_RPC_H_
+
+#ifndef __native_client__
+#include "native_client/src/include/portability.h"
+#endif // __native_client__
+#include "native_client/src/shared/srpc/nacl_srpc.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_module.h"
+#include "ppapi/c/pp_resource.h"
+
+class CompletionCallbackRpcServer {
+ public:
+ static void RunCompletionCallback(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ int32_t callback_id,
+ int32_t result,
+ nacl_abi_size_t read_buffer_bytes, char* read_buffer);
+
+ private:
+ CompletionCallbackRpcServer();
+ CompletionCallbackRpcServer(const CompletionCallbackRpcServer&);
+ void operator=(const CompletionCallbackRpcServer);
+}; // class CompletionCallbackRpcServer
+
+class PppRpcServer {
+ public:
+ static void PPP_InitializeModule(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ int32_t pid,
+ PP_Module module,
+ NaClSrpcImcDescType upcall_channel_desc,
+ char* service_description,
+ int32_t* nacl_pid,
+ int32_t* success);
+ static void PPP_ShutdownModule(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done);
+ static void PPP_GetInterface(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ char* interface_name,
+ int32_t* exports_interface_name);
+
+ private:
+ PppRpcServer();
+ PppRpcServer(const PppRpcServer&);
+ void operator=(const PppRpcServer);
+}; // class PppRpcServer
+
+class PppAudioRpcServer {
+ public:
+ static void PPP_Audio_StreamCreated(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ NaClSrpcImcDescType out_shm,
+ int32_t out_shm_size,
+ NaClSrpcImcDescType out_socket);
+
+ private:
+ PppAudioRpcServer();
+ PppAudioRpcServer(const PppAudioRpcServer&);
+ void operator=(const PppAudioRpcServer);
+}; // class PppAudioRpcServer
+
+class PppFindRpcServer {
+ public:
+ static void PPP_Find_StartFind(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ nacl_abi_size_t text_bytes, char* text,
+ int32_t case_sensitive,
+ int32_t* supports_find);
+ static void PPP_Find_SelectFindResult(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ int32_t forward);
+ static void PPP_Find_StopFind(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance);
+
+ private:
+ PppFindRpcServer();
+ PppFindRpcServer(const PppFindRpcServer&);
+ void operator=(const PppFindRpcServer);
+}; // class PppFindRpcServer
+
+class PppInputEventRpcServer {
+ public:
+ static void PPP_InputEvent_HandleInputEvent(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ PP_Resource resource,
+ nacl_abi_size_t event_data_bytes, char* event_data,
+ nacl_abi_size_t character_text_bytes, char* character_text,
+ int32_t* handled);
+
+ private:
+ PppInputEventRpcServer();
+ PppInputEventRpcServer(const PppInputEventRpcServer&);
+ void operator=(const PppInputEventRpcServer);
+}; // class PppInputEventRpcServer
+
+class PppInstanceRpcServer {
+ public:
+ static void PPP_Instance_DidCreate(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ int32_t argc,
+ nacl_abi_size_t argn_bytes, char* argn,
+ nacl_abi_size_t argv_bytes, char* argv,
+ int32_t* success);
+ static void PPP_Instance_DidDestroy(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance);
+ static void PPP_Instance_DidChangeView(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ PP_Resource resource,
+ nacl_abi_size_t view_data_bytes, char* view_data);
+ static void PPP_Instance_DidChangeFocus(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ bool has_focus);
+ static void PPP_Instance_HandleDocumentLoad(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ PP_Resource url_loader,
+ int32_t* success);
+
+ private:
+ PppInstanceRpcServer();
+ PppInstanceRpcServer(const PppInstanceRpcServer&);
+ void operator=(const PppInstanceRpcServer);
+}; // class PppInstanceRpcServer
+
+class PppMessagingRpcServer {
+ public:
+ static void PPP_Messaging_HandleMessage(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ nacl_abi_size_t message_bytes, char* message);
+
+ private:
+ PppMessagingRpcServer();
+ PppMessagingRpcServer(const PppMessagingRpcServer&);
+ void operator=(const PppMessagingRpcServer);
+}; // class PppMessagingRpcServer
+
+class PppMouseLockRpcServer {
+ public:
+ static void PPP_MouseLock_MouseLockLost(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance);
+
+ private:
+ PppMouseLockRpcServer();
+ PppMouseLockRpcServer(const PppMouseLockRpcServer&);
+ void operator=(const PppMouseLockRpcServer);
+}; // class PppMouseLockRpcServer
+
+class PppPrintingRpcServer {
+ public:
+ static void PPP_Printing_QuerySupportedFormats(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ int32_t* formats);
+ static void PPP_Printing_Begin(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ nacl_abi_size_t print_settings_bytes, char* print_settings,
+ int32_t* pages_required);
+ static void PPP_Printing_PrintPages(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ nacl_abi_size_t page_ranges_bytes, char* page_ranges,
+ int32_t page_range_count,
+ PP_Resource* image_data);
+ static void PPP_Printing_End(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance);
+ static void PPP_Printing_IsScalingDisabled(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ int32_t* result);
+
+ private:
+ PppPrintingRpcServer();
+ PppPrintingRpcServer(const PppPrintingRpcServer&);
+ void operator=(const PppPrintingRpcServer);
+}; // class PppPrintingRpcServer
+
+class PppScrollbarRpcServer {
+ public:
+ static void PPP_Scrollbar_ValueChanged(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ PP_Resource scrollbar,
+ int32_t value);
+ static void PPP_Scrollbar_OverlayChanged(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ PP_Resource scrollbar,
+ int32_t overlay);
+
+ private:
+ PppScrollbarRpcServer();
+ PppScrollbarRpcServer(const PppScrollbarRpcServer&);
+ void operator=(const PppScrollbarRpcServer);
+}; // class PppScrollbarRpcServer
+
+class PppSelectionRpcServer {
+ public:
+ static void PPP_Selection_GetSelectedText(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ int32_t html,
+ nacl_abi_size_t* selected_text_bytes, char* selected_text);
+
+ private:
+ PppSelectionRpcServer();
+ PppSelectionRpcServer(const PppSelectionRpcServer&);
+ void operator=(const PppSelectionRpcServer);
+}; // class PppSelectionRpcServer
+
+class PppWidgetRpcServer {
+ public:
+ static void PPP_Widget_Invalidate(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ PP_Resource widget,
+ nacl_abi_size_t dirty_rect_bytes, char* dirty_rect);
+
+ private:
+ PppWidgetRpcServer();
+ PppWidgetRpcServer(const PppWidgetRpcServer&);
+ void operator=(const PppWidgetRpcServer);
+}; // class PppWidgetRpcServer
+
+class PppZoomRpcServer {
+ public:
+ static void PPP_Zoom_Zoom(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ double factor,
+ int32_t text_only);
+
+ private:
+ PppZoomRpcServer();
+ PppZoomRpcServer(const PppZoomRpcServer&);
+ void operator=(const PppZoomRpcServer);
+}; // class PppZoomRpcServer
+
+class PppRpcs {
+ public:
+ static NaClSrpcHandlerDesc srpc_methods[];
+}; // class PppRpcs
+
+
+#endif // GEN_PPAPI_PROXY_PPP_RPC_H_
+
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/view_data.cc b/ppapi/native_client/src/shared/ppapi_proxy/view_data.cc new file mode 100644 index 0000000..40abea3 --- /dev/null +++ b/ppapi/native_client/src/shared/ppapi_proxy/view_data.cc @@ -0,0 +1,16 @@ +// Copyright (c) 2011 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.
+
+#include "ppapi/native_client/src/shared/ppapi_proxy/view_data.h"
+
+namespace ppapi_proxy {
+
+ViewData::ViewData()
+ : viewport_rect(PP_MakeRectFromXYWH(0, 0, 0, 0)),
+ is_fullscreen(PP_FALSE),
+ is_page_visible(PP_FALSE),
+ clip_rect(PP_MakeRectFromXYWH(0, 0, 0, 0)) {
+}
+
+} // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/view_data.h b/ppapi/native_client/src/shared/ppapi_proxy/view_data.h new file mode 100644 index 0000000..82446e0 --- /dev/null +++ b/ppapi/native_client/src/shared/ppapi_proxy/view_data.h @@ -0,0 +1,24 @@ +// Copyright (c) 2011 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 PPAPI_NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_VIEW_DATA_H_
+#define PPAPI_NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_VIEW_DATA_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_rect.h"
+
+namespace ppapi_proxy {
+
+struct ViewData {
+ ViewData();
+
+ PP_Rect viewport_rect;
+ PP_Bool is_fullscreen;
+ PP_Bool is_page_visible;
+ PP_Rect clip_rect;
+};
+
+} // namespace ppapi_proxy
+
+#endif // PPAPI_NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_VIEW_DATA_H_
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index d00dca4..9cdbd7c 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -1001,8 +1001,6 @@ Plugin::Plugin(PP_Instance pp_instance) last_error_string_(""), ppapi_proxy_(NULL), enable_dev_interfaces_(false), - replayDidChangeView(false), - replayHandleDocumentLoad(false), init_time_(0), ready_time_(0), nexe_size_(0), @@ -1080,19 +1078,16 @@ Plugin::~Plugin() { } -void Plugin::DidChangeView(const pp::Rect& position, const pp::Rect& clip) { +void Plugin::DidChangeView(const pp::View& view) { PLUGIN_PRINTF(("Plugin::DidChangeView (this=%p)\n", static_cast<void*>(this))); if (!BrowserPpp::is_valid(ppapi_proxy_)) { // Store this event and replay it when the proxy becomes available. - replayDidChangeView = true; - replayDidChangeViewPosition = position; - replayDidChangeViewClip = clip; - return; + view_to_replay_ = view; } else { ppapi_proxy_->ppp_instance_interface()->DidChangeView( - pp_instance(), &(position.pp_rect()), &(clip.pp_rect())); + pp_instance(), view.pp_resource()); } } @@ -1100,9 +1095,7 @@ void Plugin::DidChangeView(const pp::Rect& position, const pp::Rect& clip) { void Plugin::DidChangeFocus(bool has_focus) { PLUGIN_PRINTF(("Plugin::DidChangeFocus (this=%p)\n", static_cast<void*>(this))); - if (!BrowserPpp::is_valid(ppapi_proxy_)) { - return; - } else { + if (BrowserPpp::is_valid(ppapi_proxy_)) { ppapi_proxy_->ppp_instance_interface()->DidChangeFocus( pp_instance(), PP_FromBool(has_focus)); } @@ -1130,8 +1123,7 @@ bool Plugin::HandleDocumentLoad(const pp::URLLoader& url_loader) { static_cast<void*>(this))); if (!BrowserPpp::is_valid(ppapi_proxy_)) { // Store this event and replay it when the proxy becomes available. - replayHandleDocumentLoad = true; - replayHandleDocumentLoadURLLoader = url_loader; + document_load_to_replay_ = url_loader; // Return true so that the browser keeps servicing this loader so we can // perform requests on it later. return true; @@ -1384,7 +1376,7 @@ bool Plugin::StartProxiedExecution(NaClSrpcChannel* srpc_channel, CHECK(module != NULL); // We could not have gotten past init stage otherwise. int32_t pp_error = ppapi_proxy->InitializeModule(module->pp_module(), - module->get_browser_interface()); + module->get_browser_interface()); PLUGIN_PRINTF(("Plugin::StartProxiedExecution (pp_error=%" NACL_PRId32")\n", pp_error)); if (pp_error != PP_OK) { @@ -1421,15 +1413,13 @@ bool Plugin::StartProxiedExecution(NaClSrpcChannel* srpc_channel, zoom_adapter_.reset(new(std::nothrow) ZoomAdapter(this)); // Replay missed events. - if (replayDidChangeView) { - replayDidChangeView = false; - DidChangeView(replayDidChangeViewPosition, replayDidChangeViewClip); - } - if (replayHandleDocumentLoad) { - replayHandleDocumentLoad = false; - HandleDocumentLoad(replayHandleDocumentLoadURLLoader); - // Release our reference on this loader. - replayHandleDocumentLoadURLLoader = pp::URLLoader(); + if (!view_to_replay_.is_null()) { + DidChangeView(view_to_replay_); + view_to_replay_ = pp::View(); + } + if (!document_load_to_replay_.is_null()) { + HandleDocumentLoad(document_load_to_replay_); + document_load_to_replay_ = pp::URLLoader(); } bool is_valid_proxy = BrowserPpp::is_valid(ppapi_proxy_); PLUGIN_PRINTF(("Plugin::StartProxiedExecution (is_valid_proxy=%d)\n", diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h index 4836312..94a1307 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.h +++ b/ppapi/native_client/src/trusted/plugin/plugin.h @@ -33,6 +33,7 @@ #include "ppapi/cpp/rect.h" #include "ppapi/cpp/url_loader.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/view.h" struct NaClSrpcChannel; @@ -84,7 +85,7 @@ class Plugin : public pp::InstancePrivate { virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); // Handles view changes from the browser. - virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip); + virtual void DidChangeView(const pp::View& view); // Handles gaining or losing focus. virtual void DidChangeFocus(bool has_focus); @@ -519,15 +520,14 @@ class Plugin : public pp::InstancePrivate { bool enable_dev_interfaces_; // If we get a DidChangeView event before the nexe is loaded, we store it and - // replay it to nexe after it's loaded. - bool replayDidChangeView; - pp::Rect replayDidChangeViewPosition; - pp::Rect replayDidChangeViewClip; + // replay it to nexe after it's loaded. We need to replay when this View + // resource is non-is_null(). + pp::View view_to_replay_; // If we get a HandleDocumentLoad event before the nexe is loaded, we store - // it and replay it to nexe after it's loaded. - bool replayHandleDocumentLoad; - pp::URLLoader replayHandleDocumentLoadURLLoader; + // it and replay it to nexe after it's loaded. We need to replay when this + // URLLoader resource is non-is_null(). + pp::URLLoader document_load_to_replay_; nacl::string mime_type_; diff --git a/ppapi/native_client/tests/earth/pepper_c.c b/ppapi/native_client/tests/earth/pepper_c.c index 697675d..44e81d9 100644 --- a/ppapi/native_client/tests/earth/pepper_c.c +++ b/ppapi/native_client/tests/earth/pepper_c.c @@ -25,6 +25,7 @@ #include "ppapi/c/ppb_graphics_2d.h" #include "ppapi/c/ppb_image_data.h" #include "ppapi/c/ppb_instance.h" +#include "ppapi/c/ppb_view.h" #include "ppapi/c/ppp.h" #include "ppapi/c/ppp_instance.h" @@ -46,6 +47,7 @@ struct PepperState { const struct PPB_Graphics2D* graphics_2d_interface; const struct PPB_ImageData* image_data_interface; const struct PPB_Instance* instance_interface; + const struct PPB_View* view_interface; PP_Resource device_context; int32_t which_image; PP_Resource image[NUMBER_OF_IMAGES]; @@ -129,16 +131,15 @@ static PP_Resource MakeAndBindDeviceContext(PP_Instance instance, } static void Instance_DidChangeView(PP_Instance pp_instance, - const struct PP_Rect* position, - const struct PP_Rect* clip) { + PP_Resource pp_view) { DebugPrintf("DidChangeView(%x)\n", pp_instance); assert(g_MyStateIsValid == true); assert(g_MyState.instance == pp_instance); - g_MyState.position = *position; + g_MyState.view_interface->GetRect(pp_view, &g_MyState.position); if (g_MyState.ready == false) { g_MyState.device_context = - MakeAndBindDeviceContext(pp_instance, &position->size); + MakeAndBindDeviceContext(pp_instance, &g_MyState.position.size); /* create device context */ if (!g_MyState.device_context) { DebugPrintf("device_context is null!\n"); @@ -154,7 +155,7 @@ static void Instance_DidChangeView(PP_Instance pp_instance, for (int i = 0; i < NUMBER_OF_IMAGES; ++i) { g_MyState.image[i] = g_MyState.image_data_interface->Create(pp_instance, - PP_IMAGEDATAFORMAT_BGRA_PREMUL, &position->size, PP_TRUE); + PP_IMAGEDATAFORMAT_BGRA_PREMUL, &g_MyState.position.size, PP_TRUE); if (!g_MyState.image[i]) { DebugPrintf("image resource is invalid!\n"); return; @@ -165,8 +166,8 @@ static void Instance_DidChangeView(PP_Instance pp_instance, DebugPrintf("could not allocate image_data\n"); return; } - size_t size_in_bytes = position->size.width * position->size.height * - sizeof(uint32_t); + size_t size_in_bytes = g_MyState.position.size.width * + g_MyState.position.size.height * sizeof(uint32_t); memset(g_MyState.image_data[i], 0, size_in_bytes); } g_MyState.ready = true; @@ -206,10 +207,13 @@ PP_EXPORT int32_t PPP_InitializeModule(PP_Module module, get_browser_interface(PPB_IMAGEDATA_INTERFACE); g_MyState.graphics_2d_interface = (const struct PPB_Graphics2D*) get_browser_interface(PPB_GRAPHICS_2D_INTERFACE); + g_MyState.view_interface = (const struct PPB_View*) + get_browser_interface(PPB_VIEW_INTERFACE); if (!g_MyState.core_interface || !g_MyState.instance_interface || !g_MyState.image_data_interface || - !g_MyState.graphics_2d_interface) + !g_MyState.graphics_2d_interface || + !g_MyState.view_interface) return -1; return PP_OK; diff --git a/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_ppp_initialize_crash.cc b/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_ppp_initialize_crash.cc index 24cb516..050b251 100644 --- a/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_ppp_initialize_crash.cc +++ b/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_ppp_initialize_crash.cc @@ -43,9 +43,7 @@ PP_Bool DidCreate(PP_Instance /*instance*/, void DidDestroy(PP_Instance /*instance*/) { } -void DidChangeView(PP_Instance /*instance*/, - const struct PP_Rect* /*position*/, - const struct PP_Rect* /*clip*/) { +void DidChangeView(PP_Instance /*instance*/, PP_Resource /*view*/) { } void DidChangeFocus(PP_Instance /*instance*/, PP_Bool /*has_focus*/) { diff --git a/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_ppp_instance_didcreate.cc b/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_ppp_instance_didcreate.cc index 16a3255..6e4d153 100644 --- a/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_ppp_instance_didcreate.cc +++ b/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad_ppp_instance_didcreate.cc @@ -41,8 +41,7 @@ void DidDestroy(PP_Instance /*instance*/) { } void DidChangeView(PP_Instance /*instance*/, - const struct PP_Rect* /*position*/, - const struct PP_Rect* /*clip*/) { + PP_Resource /*view*/) { } void DidChangeFocus(PP_Instance /*instance*/, PP_Bool /*has_focus*/) { diff --git a/ppapi/native_client/tests/ppapi_browser/ppp_instance/ppapi_ppp_instance.cc b/ppapi/native_client/tests/ppapi_browser/ppp_instance/ppapi_ppp_instance.cc index d00f2ae..f77d58b 100644 --- a/ppapi/native_client/tests/ppapi_browser/ppp_instance/ppapi_ppp_instance.cc +++ b/ppapi/native_client/tests/ppapi_browser/ppp_instance/ppapi_ppp_instance.cc @@ -14,6 +14,7 @@ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_input_event.h" +#include "ppapi/c/ppb_view.h" #include "ppapi/c/ppp_instance.h" namespace { @@ -37,15 +38,19 @@ void DidDestroy(PP_Instance instance) { NACL_NOTREACHED(); } -void DidChangeView(PP_Instance instance, - const struct PP_Rect* position, - const struct PP_Rect* clip) { +void DidChangeView(PP_Instance instance, PP_Resource view) { printf("--- PPP_Instance::DidChangeView\n"); EXPECT(instance == pp_instance()); - EXPECT(clip->point.x == 0 && clip->point.y == 0); + + PP_Rect clip; + PPBView()->GetClipRect(view, &clip); + EXPECT(clip.point.x == 0 && clip.point.y == 0); + // These are based on embed dimensions. - EXPECT(position->size.width == 15 && clip->size.width == 15); - EXPECT(position->size.height == 20 && clip->size.height == 20); + PP_Rect position; + PPBView()->GetRect(view, &position); + EXPECT(position.size.width == 15 && clip.size.width == 15); + EXPECT(position.size.height == 20 && clip.size.height == 20); TEST_PASSED; } diff --git a/ppapi/native_client/tests/ppapi_geturl/module.cc b/ppapi/native_client/tests/ppapi_geturl/module.cc index a610f08..18ee82c 100644 --- a/ppapi/native_client/tests/ppapi_geturl/module.cc +++ b/ppapi/native_client/tests/ppapi_geturl/module.cc @@ -56,9 +56,7 @@ void Instance_DidDestroy(PP_Instance /*instance*/) { printf("--- Instance_DidDestroy\n"); } -void Instance_DidChangeView(PP_Instance /*pp_instance*/, - const PP_Rect* /*position*/, - const PP_Rect* /*clip*/) { +void Instance_DidChangeView(PP_Instance /*pp_instance*/, PP_Resource /*view*/) { } void Instance_DidChangeFocus(PP_Instance /*pp_instance*/, diff --git a/ppapi/native_client/tests/ppapi_messaging/ppapi_messaging.c b/ppapi/native_client/tests/ppapi_messaging/ppapi_messaging.c index 1caedd1..fe151eb 100644 --- a/ppapi/native_client/tests/ppapi_messaging/ppapi_messaging.c +++ b/ppapi/native_client/tests/ppapi_messaging/ppapi_messaging.c @@ -99,11 +99,9 @@ void DidDestroy(PP_Instance instance) { } void DidChangeView(PP_Instance instance, - const struct PP_Rect* position, - const struct PP_Rect* clip) { + PP_Resource resource) { UNREFERENCED_PARAMETER(instance); - UNREFERENCED_PARAMETER(position); - UNREFERENCED_PARAMETER(clip); + UNREFERENCED_PARAMETER(resource); } void DidChangeFocus(PP_Instance instance, diff --git a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc index 8c23d1a4..b0d5f56 100644 --- a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc +++ b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc @@ -27,6 +27,7 @@ #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" #include "ppapi/c/ppb_var.h" +#include "ppapi/c/ppb_view.h" #include "native_client/tests/ppapi_test_lib/get_browser_interface.h" #include "native_client/tests/ppapi_test_lib/internal_utils.h" @@ -173,6 +174,11 @@ const PPB_Testing_Dev* PPBTestingDev() { GetBrowserInterface(PPB_TESTING_DEV_INTERFACE)); } +const PPB_View* PPBView() { + return reinterpret_cast<const PPB_View*>( + GetBrowserInterface(PPB_VIEW_INTERFACE)); +} + const PPB_Widget_Dev* PPBWidgetDev() { return reinterpret_cast<const PPB_Widget_Dev*>( // Change to GetBrowserInterfaceSafe when moving out of dev. diff --git a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h index 04df592..8fbf73e 100644 --- a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h +++ b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h @@ -35,6 +35,7 @@ struct PPB_URLLoader; struct PPB_URLRequestInfo; struct PPB_URLResponseInfo; struct PPB_Var; +struct PPB_View; struct PPB_WheelInputEvent; struct PPB_Widget_Dev; @@ -66,6 +67,7 @@ const PPB_URLLoader* PPBURLLoader(); const PPB_URLRequestInfo* PPBURLRequestInfo(); const PPB_URLResponseInfo* PPBURLResponseInfo(); const PPB_Var* PPBVar(); +const PPB_View* PPBView(); const PPB_WheelInputEvent* PPBWheelInputEvent(); // diff --git a/ppapi/native_client/tests/ppapi_test_lib/module_instance.cc b/ppapi/native_client/tests/ppapi_test_lib/module_instance.cc index ded3b61..b7a530d 100644 --- a/ppapi/native_client/tests/ppapi_test_lib/module_instance.cc +++ b/ppapi/native_client/tests/ppapi_test_lib/module_instance.cc @@ -96,9 +96,7 @@ PP_Bool DidCreateDefault(PP_Instance instance, void DidDestroyDefault(PP_Instance /*instance*/) { } -void DidChangeViewDefault(PP_Instance /*instance*/, - const struct PP_Rect* /*position*/, - const struct PP_Rect* /*clip*/) { +void DidChangeViewDefault(PP_Instance /*instance*/, PP_Resource /*view*/) { } void DidChangeFocusDefault(PP_Instance /*instance*/, diff --git a/ppapi/native_client/tests/ppapi_test_lib/test_interface.h b/ppapi/native_client/tests/ppapi_test_lib/test_interface.h index c0b0d10..e5424a6 100644 --- a/ppapi/native_client/tests/ppapi_test_lib/test_interface.h +++ b/ppapi/native_client/tests/ppapi_test_lib/test_interface.h @@ -183,9 +183,7 @@ PP_Bool DidCreateDefault(PP_Instance instance, uint32_t argc, const char* argn[], const char* argv[]); // Other default implementations of the required PPP_Instance functions. void DidDestroyDefault(PP_Instance instance); -void DidChangeViewDefault(PP_Instance instance, - const struct PP_Rect* position, - const struct PP_Rect* clip); +void DidChangeViewDefault(PP_Instance instance, PP_Resource view); void DidChangeFocusDefault(PP_Instance instance, PP_Bool has_focus); PP_Bool HandleDocumentLoadDefault(PP_Instance instance, PP_Resource url_loader); diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi index a497a63..adc64b4 100644 --- a/ppapi/ppapi_shared.gypi +++ b/ppapi/ppapi_shared.gypi @@ -79,6 +79,8 @@ 'shared_impl/ppb_var_shared.h', 'shared_impl/ppb_video_decoder_shared.cc', 'shared_impl/ppb_video_decoder_shared.h', + 'shared_impl/ppb_view_shared.cc', + 'shared_impl/ppb_view_shared.h', 'shared_impl/ppp_instance_combined.cc', 'shared_impl/ppp_instance_combined.h', 'shared_impl/proxy_lock.cc', @@ -193,6 +195,8 @@ 'thunk/ppb_video_decoder_thunk.cc', 'thunk/ppb_video_layer_api.h', 'thunk/ppb_video_layer_thunk.cc', + 'thunk/ppb_view_api.h', + 'thunk/ppb_view_thunk.cc', 'thunk/ppb_websocket_api.h', 'thunk/ppb_websocket_thunk.cc', 'thunk/ppb_widget_api.h', diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi index f68c7f9..84b354d 100644 --- a/ppapi/ppapi_sources.gypi +++ b/ppapi/ppapi_sources.gypi @@ -41,6 +41,7 @@ 'c/ppb_url_request_info.h', 'c/ppb_url_response_info.h', 'c/ppb_var.h', + 'c/ppb_view.h', 'c/ppp.h', 'c/ppp_graphics_3d.h', 'c/ppp_input_event.h', @@ -169,6 +170,8 @@ 'cpp/url_response_info.h', 'cpp/var.cc', 'cpp/var.h', + 'cpp/view.cc', + 'cpp/view.h', # Dev interfaces. 'cpp/dev/audio_input_dev.cc', diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index 9cd3e07..436cbc5c 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -39,6 +39,7 @@ #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" #include "ppapi/c/ppb_var.h" +#include "ppapi/c/ppb_view.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppp_instance.h" #include "ppapi/c/private/ppb_file_ref_private.h" @@ -186,12 +187,17 @@ InterfaceList::InterfaceList() { AddPPB(PPB_Var_Deprecated_Proxy::GetInfo()); // PPP (plugin) interfaces. + // TODO(brettw) move these to interface_list*.h + AddProxy(API_ID_PPP_INSTANCE, &ProxyFactory<PPP_Instance_Proxy>); + AddPPP(PPP_INSTANCE_INTERFACE_1_1, API_ID_PPP_INSTANCE, + PPP_Instance_Proxy::GetInstanceInterface()); + + // Old-style GetInfo PPP interfaces. // Do not add more stuff here, they should be added to interface_list*.h // TODO(brettw) remove these. AddPPP(PPP_Graphics3D_Proxy::GetInfo()); AddPPP(PPP_InputEvent_Proxy::GetInfo()); AddPPP(PPP_Instance_Private_Proxy::GetInfo()); - AddPPP(PPP_Instance_Proxy::GetInfo1_0()); AddPPP(PPP_Messaging_Proxy::GetInfo()); AddPPP(PPP_MouseLock_Proxy::GetInfo()); AddPPP(PPP_VideoCapture_Proxy::GetInfo()); diff --git a/ppapi/proxy/plugin_dispatcher.cc b/ppapi/proxy/plugin_dispatcher.cc index c1eca3f..b036978 100644 --- a/ppapi/proxy/plugin_dispatcher.cc +++ b/ppapi/proxy/plugin_dispatcher.cc @@ -13,6 +13,7 @@ #include "ipc/ipc_sync_channel.h" #include "base/debug/trace_event.h" #include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppp_instance.h" #include "ppapi/proxy/interface_list.h" #include "ppapi/proxy/interface_proxy.h" #include "ppapi/proxy/plugin_message_filter.h" @@ -42,10 +43,8 @@ InstanceToDispatcherMap* g_instance_to_dispatcher = NULL; } // namespace InstanceData::InstanceData() - : fullscreen(PP_FALSE), - flash_fullscreen(PP_FALSE), + : flash_fullscreen(PP_FALSE), mouse_lock_callback(PP_BlockUntilComplete()) { - memset(&position, 0, sizeof(position)); } InstanceData::~InstanceData() { @@ -219,6 +218,14 @@ void PluginDispatcher::OnMsgSupportsInterface( const std::string& interface_name, bool* result) { *result = !!GetPluginInterface(interface_name); + + // Do fallback for PPP_Instance. This is a hack here and if we have more + // cases like this it should be generalized. The PPP_Instance proxy always + // proxies the 1.1 interface, and then does fallback to 1.0 inside the + // plugin process (see PPP_Instance_Proxy). So here we return true for + // supporting the 1.1 interface if either 1.1 or 1.0 is supported. + if (!*result && interface_name == PPP_INSTANCE_INTERFACE) + *result = !!GetPluginInterface(PPP_INSTANCE_INTERFACE_1_0); } void PluginDispatcher::OnMsgSetPreferences(const Preferences& prefs) { diff --git a/ppapi/proxy/plugin_dispatcher.h b/ppapi/proxy/plugin_dispatcher.h index 31fe221..47df95d 100644 --- a/ppapi/proxy/plugin_dispatcher.h +++ b/ppapi/proxy/plugin_dispatcher.h @@ -18,6 +18,7 @@ #include "ppapi/proxy/dispatcher.h" #include "ppapi/shared_impl/function_group_base.h" #include "ppapi/shared_impl/ppapi_preferences.h" +#include "ppapi/shared_impl/ppb_view_shared.h" namespace ppapi { @@ -32,8 +33,8 @@ struct InstanceData { InstanceData(); ~InstanceData(); - PP_Rect position; - PP_Bool fullscreen; // Used for PPB_Fullscreen. + ViewData view; + PP_Bool flash_fullscreen; // Used for PPB_FlashFullscreen. // When non-0, indicates the callback to execute when mouse lock is lost. diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index c424d7d..0b47a71 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -19,6 +19,7 @@ #include "ipc/ipc_message_utils.h" #include "ipc/ipc_platform_file.h" #include "ppapi/c/dev/pp_video_capture_dev.h" +#include "ppapi/c/dev/pp_video_dev.h" #include "ppapi/c/dev/ppb_text_input_dev.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_file_info.h" @@ -28,7 +29,6 @@ #include "ppapi/c/pp_rect.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_size.h" -#include "ppapi/c/dev/pp_video_dev.h" #include "ppapi/c/private/ppb_tcp_socket_private.h" #include "ppapi/proxy/ppapi_param_traits.h" #include "ppapi/proxy/ppapi_proxy_export.h" @@ -37,6 +37,7 @@ #include "ppapi/shared_impl/ppapi_preferences.h" #include "ppapi/shared_impl/ppb_input_event_shared.h" #include "ppapi/shared_impl/ppb_url_request_info_shared.h" +#include "ppapi/shared_impl/ppb_view_shared.h" #undef IPC_MESSAGE_EXPORT #define IPC_MESSAGE_EXPORT PPAPI_PROXY_EXPORT @@ -92,6 +93,13 @@ IPC_STRUCT_TRAITS_BEGIN(ppapi::proxy::PPPVideoCapture_Buffer) IPC_STRUCT_TRAITS_MEMBER(size) IPC_STRUCT_TRAITS_END() +IPC_STRUCT_TRAITS_BEGIN(ppapi::ViewData) + IPC_STRUCT_TRAITS_MEMBER(rect) + IPC_STRUCT_TRAITS_MEMBER(is_fullscreen) + IPC_STRUCT_TRAITS_MEMBER(is_page_visible) + IPC_STRUCT_TRAITS_MEMBER(clip_rect) +IPC_STRUCT_TRAITS_END() + IPC_STRUCT_TRAITS_BEGIN(ppapi::Preferences) IPC_STRUCT_TRAITS_MEMBER(standard_font_family) IPC_STRUCT_TRAITS_MEMBER(fixed_font_family) @@ -402,11 +410,9 @@ IPC_SYNC_MESSAGE_ROUTED3_1(PpapiMsg_PPPInstance_DidCreate, PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED1_0(PpapiMsg_PPPInstance_DidDestroy, PP_Instance /* instance */) -IPC_MESSAGE_ROUTED5(PpapiMsg_PPPInstance_DidChangeView, +IPC_MESSAGE_ROUTED3(PpapiMsg_PPPInstance_DidChangeView, PP_Instance /* instance */, - PP_Rect /* position */, - PP_Rect /* clip */, - PP_Bool /* fullscreen */, + ppapi::ViewData /* new_data */, PP_Bool /* flash_fullscreen */) IPC_MESSAGE_ROUTED2(PpapiMsg_PPPInstance_DidChangeFocus, PP_Instance /* instance */, diff --git a/ppapi/proxy/ppapi_param_traits.h b/ppapi/proxy/ppapi_param_traits.h index 57706c5..63121f0 100644 --- a/ppapi/proxy/ppapi_param_traits.h +++ b/ppapi/proxy/ppapi_param_traits.h @@ -23,7 +23,6 @@ struct PP_NetAddress_Private; namespace ppapi { class HostResource; -//struct PPB_FileRef_CreateInfo; namespace proxy { diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index af417e8..c6f5c27 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc @@ -16,6 +16,7 @@ #include "ppapi/proxy/serialized_var.h" #include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/ppb_url_util_shared.h" +#include "ppapi/shared_impl/ppb_view_shared.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/thunk.h" @@ -72,53 +73,53 @@ bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy, msg) // Plugin -> Host messages. IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject, - OnMsgGetWindowObject) + OnHostMsgGetWindowObject) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject, - OnMsgGetOwnerElementObject) + OnHostMsgGetOwnerElementObject) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics, - OnMsgBindGraphics) + OnHostMsgBindGraphics) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame, - OnMsgIsFullFrame) + OnHostMsgIsFullFrame) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, - OnMsgExecuteScript) + OnHostMsgExecuteScript) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDefaultCharSet, - OnMsgGetDefaultCharSet) + OnHostMsgGetDefaultCharSet) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_Log, - OnMsgLog) + OnHostMsgLog) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LogWithSource, - OnMsgLogWithSource) + OnHostMsgLogWithSource) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage, - OnMsgPostMessage) + OnHostMsgPostMessage) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashSetFullscreen, - OnMsgFlashSetFullscreen) + OnHostMsgFlashSetFullscreen) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashGetScreenSize, - OnMsgFlashGetScreenSize) + OnHostMsgFlashGetScreenSize) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen, - OnMsgSetFullscreen) + OnHostMsgSetFullscreen) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetScreenSize, - OnMsgGetScreenSize) + OnHostMsgGetScreenSize) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents, - OnMsgRequestInputEvents) + OnHostMsgRequestInputEvents) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents, - OnMsgClearInputEvents) + OnHostMsgClearInputEvents) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LockMouse, - OnMsgLockMouse) + OnHostMsgLockMouse) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UnlockMouse, - OnMsgUnlockMouse) + OnHostMsgUnlockMouse) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument, - OnMsgResolveRelativeToDocument) + OnHostMsgResolveRelativeToDocument) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest, - OnMsgDocumentCanRequest) + OnHostMsgDocumentCanRequest) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument, - OnMsgDocumentCanAccessDocument) + OnHostMsgDocumentCanAccessDocument) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDocumentURL, - OnMsgGetDocumentURL) + OnHostMsgGetDocumentURL) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL, - OnMsgGetPluginInstanceURL) + OnHostMsgGetPluginInstanceURL) // Host -> Plugin messages. IPC_MESSAGE_HANDLER(PpapiMsg_PPBInstance_MouseLockComplete, - OnMsgMouseLockComplete) + OnPluginMsgMouseLockComplete) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -150,6 +151,14 @@ PP_Bool PPB_Instance_Proxy::IsFullFrame(PP_Instance instance) { return result; } +const ViewData* PPB_Instance_Proxy::GetViewData(PP_Instance instance) { + InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> + GetInstanceData(instance); + if (!data) + return NULL; + return &data->view; +} + PP_Var PPB_Instance_Proxy::GetWindowObject(PP_Instance instance) { ReceiveSerializedVarReturnValue result; dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetWindowObject( @@ -218,14 +227,6 @@ void PPB_Instance_Proxy::SelectedFindResultChanged(PP_Instance instance, NOTIMPLEMENTED(); // Not proxied yet. } -PP_Bool PPB_Instance_Proxy::IsFullscreen(PP_Instance instance) { - InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> - GetInstanceData(instance); - if (!data) - return PP_FALSE; - return data->fullscreen; -} - PP_Bool PPB_Instance_Proxy::FlashIsFullscreen(PP_Instance instance) { InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> GetInstanceData(instance); @@ -392,7 +393,7 @@ void PPB_Instance_Proxy::UnlockMouse(PP_Instance instance) { API_ID_PPB_INSTANCE, instance)); } -void PPB_Instance_Proxy::OnMsgGetWindowObject( +void PPB_Instance_Proxy::OnHostMsgGetWindowObject( PP_Instance instance, SerializedVarReturnValue result) { EnterInstanceNoLock enter(instance, false); @@ -400,7 +401,7 @@ void PPB_Instance_Proxy::OnMsgGetWindowObject( result.Return(dispatcher(), enter.functions()->GetWindowObject(instance)); } -void PPB_Instance_Proxy::OnMsgGetOwnerElementObject( +void PPB_Instance_Proxy::OnHostMsgGetOwnerElementObject( PP_Instance instance, SerializedVarReturnValue result) { EnterInstanceNoLock enter(instance, false); @@ -410,9 +411,9 @@ void PPB_Instance_Proxy::OnMsgGetOwnerElementObject( } } -void PPB_Instance_Proxy::OnMsgBindGraphics(PP_Instance instance, - const HostResource& device, - PP_Bool* result) { +void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance, + const HostResource& device, + PP_Bool* result) { EnterInstanceNoLock enter(instance, false); if (enter.succeeded()) { *result = enter.functions()->BindGraphics(instance, @@ -420,14 +421,14 @@ void PPB_Instance_Proxy::OnMsgBindGraphics(PP_Instance instance, } } -void PPB_Instance_Proxy::OnMsgIsFullFrame(PP_Instance instance, - PP_Bool* result) { +void PPB_Instance_Proxy::OnHostMsgIsFullFrame(PP_Instance instance, + PP_Bool* result) { EnterInstanceNoLock enter(instance, false); if (enter.succeeded()) *result = enter.functions()->IsFullFrame(instance); } -void PPB_Instance_Proxy::OnMsgExecuteScript( +void PPB_Instance_Proxy::OnHostMsgExecuteScript( PP_Instance instance, SerializedVarReceiveInput script, SerializedVarOutParam out_exception, @@ -447,7 +448,7 @@ void PPB_Instance_Proxy::OnMsgExecuteScript( out_exception.OutParam(dispatcher()))); } -void PPB_Instance_Proxy::OnMsgGetDefaultCharSet( +void PPB_Instance_Proxy::OnHostMsgGetDefaultCharSet( PP_Instance instance, SerializedVarReturnValue result) { EnterInstanceNoLock enter(instance, false); @@ -455,18 +456,19 @@ void PPB_Instance_Proxy::OnMsgGetDefaultCharSet( result.Return(dispatcher(), enter.functions()->GetDefaultCharSet(instance)); } -void PPB_Instance_Proxy::OnMsgLog(PP_Instance instance, - int log_level, - SerializedVarReceiveInput value) { +void PPB_Instance_Proxy::OnHostMsgLog(PP_Instance instance, + int log_level, + SerializedVarReceiveInput value) { EnterInstanceNoLock enter(instance, false); if (enter.succeeded()) enter.functions()->Log(instance, log_level, value.Get(dispatcher())); } -void PPB_Instance_Proxy::OnMsgLogWithSource(PP_Instance instance, - int log_level, - SerializedVarReceiveInput source, - SerializedVarReceiveInput value) { +void PPB_Instance_Proxy::OnHostMsgLogWithSource( + PP_Instance instance, + int log_level, + SerializedVarReceiveInput source, + SerializedVarReceiveInput value) { EnterInstanceNoLock enter(instance, false); if (enter.succeeded()) { enter.functions()->LogWithSource(instance, log_level, @@ -475,42 +477,42 @@ void PPB_Instance_Proxy::OnMsgLogWithSource(PP_Instance instance, } } -void PPB_Instance_Proxy::OnMsgSetFullscreen(PP_Instance instance, - PP_Bool fullscreen, - PP_Bool* result) { +void PPB_Instance_Proxy::OnHostMsgSetFullscreen(PP_Instance instance, + PP_Bool fullscreen, + PP_Bool* result) { EnterInstanceNoLock enter(instance, false); if (enter.succeeded()) *result = enter.functions()->SetFullscreen(instance, fullscreen); } -void PPB_Instance_Proxy::OnMsgFlashSetFullscreen(PP_Instance instance, - PP_Bool fullscreen, - PP_Bool* result) { +void PPB_Instance_Proxy::OnHostMsgFlashSetFullscreen(PP_Instance instance, + PP_Bool fullscreen, + PP_Bool* result) { EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); if (enter.succeeded()) *result = enter.functions()->FlashSetFullscreen(instance, fullscreen); } -void PPB_Instance_Proxy::OnMsgGetScreenSize(PP_Instance instance, - PP_Bool* result, - PP_Size* size) { +void PPB_Instance_Proxy::OnHostMsgGetScreenSize(PP_Instance instance, + PP_Bool* result, + PP_Size* size) { EnterInstanceNoLock enter(instance, false); if (enter.succeeded()) *result = enter.functions()->GetScreenSize(instance, size); } -void PPB_Instance_Proxy::OnMsgFlashGetScreenSize(PP_Instance instance, - PP_Bool* result, - PP_Size* size) { +void PPB_Instance_Proxy::OnHostMsgFlashGetScreenSize(PP_Instance instance, + PP_Bool* result, + PP_Size* size) { EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); if (enter.succeeded()) *result = enter.functions()->FlashGetScreenSize(instance, size); } -void PPB_Instance_Proxy::OnMsgRequestInputEvents(PP_Instance instance, - bool is_filtering, - uint32_t event_classes) { +void PPB_Instance_Proxy::OnHostMsgRequestInputEvents(PP_Instance instance, + bool is_filtering, + uint32_t event_classes) { EnterInstanceNoLock enter(instance, false); if (enter.succeeded()) { if (is_filtering) @@ -520,21 +522,21 @@ void PPB_Instance_Proxy::OnMsgRequestInputEvents(PP_Instance instance, } } -void PPB_Instance_Proxy::OnMsgClearInputEvents(PP_Instance instance, - uint32_t event_classes) { +void PPB_Instance_Proxy::OnHostMsgClearInputEvents(PP_Instance instance, + uint32_t event_classes) { EnterInstanceNoLock enter(instance, false); if (enter.succeeded()) enter.functions()->ClearInputEventRequest(instance, event_classes); } -void PPB_Instance_Proxy::OnMsgPostMessage(PP_Instance instance, +void PPB_Instance_Proxy::OnHostMsgPostMessage(PP_Instance instance, SerializedVarReceiveInput message) { EnterInstanceNoLock enter(instance, false); if (enter.succeeded()) enter.functions()->PostMessage(instance, message.Get(dispatcher())); } -void PPB_Instance_Proxy::OnMsgLockMouse(PP_Instance instance) { +void PPB_Instance_Proxy::OnHostMsgLockMouse(PP_Instance instance) { EnterHostFunctionForceCallback<PPB_Instance_FunctionAPI> enter( instance, callback_factory_, &PPB_Instance_Proxy::MouseLockCompleteInHost, instance); @@ -542,13 +544,13 @@ void PPB_Instance_Proxy::OnMsgLockMouse(PP_Instance instance) { enter.SetResult(enter.functions()->LockMouse(instance, enter.callback())); } -void PPB_Instance_Proxy::OnMsgUnlockMouse(PP_Instance instance) { +void PPB_Instance_Proxy::OnHostMsgUnlockMouse(PP_Instance instance) { EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); if (enter.succeeded()) enter.functions()->UnlockMouse(instance); } -void PPB_Instance_Proxy::OnMsgResolveRelativeToDocument( +void PPB_Instance_Proxy::OnHostMsgResolveRelativeToDocument( PP_Instance instance, SerializedVarReceiveInput relative, SerializedVarReturnValue result) { @@ -560,9 +562,10 @@ void PPB_Instance_Proxy::OnMsgResolveRelativeToDocument( } } -void PPB_Instance_Proxy::OnMsgDocumentCanRequest(PP_Instance instance, - SerializedVarReceiveInput url, - PP_Bool* result) { +void PPB_Instance_Proxy::OnHostMsgDocumentCanRequest( + PP_Instance instance, + SerializedVarReceiveInput url, + PP_Bool* result) { EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); if (enter.succeeded()) { *result = enter.functions()->DocumentCanRequest(instance, @@ -570,16 +573,16 @@ void PPB_Instance_Proxy::OnMsgDocumentCanRequest(PP_Instance instance, } } -void PPB_Instance_Proxy::OnMsgDocumentCanAccessDocument(PP_Instance active, - PP_Instance target, - PP_Bool* result) { +void PPB_Instance_Proxy::OnHostMsgDocumentCanAccessDocument(PP_Instance active, + PP_Instance target, + PP_Bool* result) { EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(active, true); if (enter.succeeded()) *result = enter.functions()->DocumentCanAccessDocument(active, target); } -void PPB_Instance_Proxy::OnMsgGetDocumentURL(PP_Instance instance, - SerializedVarReturnValue result) { +void PPB_Instance_Proxy::OnHostMsgGetDocumentURL(PP_Instance instance, + SerializedVarReturnValue result) { EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); if (enter.succeeded()) { result.Return(dispatcher(), @@ -587,7 +590,7 @@ void PPB_Instance_Proxy::OnMsgGetDocumentURL(PP_Instance instance, } } -void PPB_Instance_Proxy::OnMsgGetPluginInstanceURL( +void PPB_Instance_Proxy::OnHostMsgGetPluginInstanceURL( PP_Instance instance, SerializedVarReturnValue result) { EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); @@ -597,8 +600,8 @@ void PPB_Instance_Proxy::OnMsgGetPluginInstanceURL( } } -void PPB_Instance_Proxy::OnMsgMouseLockComplete(PP_Instance instance, - int32_t result) { +void PPB_Instance_Proxy::OnPluginMsgMouseLockComplete(PP_Instance instance, + int32_t result) { // Save the mouse callback on the instance data. InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> GetInstanceData(instance); diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h index eeb791c..de10f80 100644 --- a/ppapi/proxy/ppb_instance_proxy.h +++ b/ppapi/proxy/ppb_instance_proxy.h @@ -47,6 +47,7 @@ class PPB_Instance_Proxy : public InterfaceProxy, virtual PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) OVERRIDE; virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE; + virtual const ViewData* GetViewData(PP_Instance instance) OVERRIDE; virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE; virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE; virtual PP_Var ExecuteScript(PP_Instance instance, @@ -65,7 +66,6 @@ class PPB_Instance_Proxy : public InterfaceProxy, PP_Bool final_result) OVERRIDE; virtual void SelectedFindResultChanged(PP_Instance instance, int32_t index) OVERRIDE; - virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE; virtual PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) OVERRIDE; virtual PP_Bool GetScreenSize(PP_Instance instance, @@ -106,64 +106,64 @@ class PPB_Instance_Proxy : public InterfaceProxy, private: // Plugin -> Host message handlers. - void OnMsgGetWindowObject(PP_Instance instance, - SerializedVarReturnValue result); - void OnMsgGetOwnerElementObject(PP_Instance instance, - SerializedVarReturnValue result); - void OnMsgBindGraphics(PP_Instance instance, - const ppapi::HostResource& device, - PP_Bool* result); - void OnMsgIsFullFrame(PP_Instance instance, PP_Bool* result); - void OnMsgExecuteScript(PP_Instance instance, - SerializedVarReceiveInput script, - SerializedVarOutParam out_exception, - SerializedVarReturnValue result); - void OnMsgGetDefaultCharSet(PP_Instance instance, - SerializedVarReturnValue result); - void OnMsgLog(PP_Instance instance, - int log_level, - SerializedVarReceiveInput value); - void OnMsgLogWithSource(PP_Instance instance, - int log_level, - SerializedVarReceiveInput source, - SerializedVarReceiveInput value); - void OnMsgSetFullscreen(PP_Instance instance, - PP_Bool fullscreen, - PP_Bool* result); - void OnMsgGetScreenSize(PP_Instance instance, - PP_Bool* result, - PP_Size* size); - void OnMsgFlashSetFullscreen(PP_Instance instance, - PP_Bool fullscreen, - PP_Bool* result); - void OnMsgFlashGetScreenSize(PP_Instance instance, - PP_Bool* result, - PP_Size* size); - void OnMsgRequestInputEvents(PP_Instance instance, - bool is_filtering, - uint32_t event_classes); - void OnMsgClearInputEvents(PP_Instance instance, - uint32_t event_classes); - void OnMsgPostMessage(PP_Instance instance, - SerializedVarReceiveInput message); - void OnMsgLockMouse(PP_Instance instance); - void OnMsgUnlockMouse(PP_Instance instance); - void OnMsgResolveRelativeToDocument(PP_Instance instance, - SerializedVarReceiveInput relative, + void OnHostMsgGetWindowObject(PP_Instance instance, + SerializedVarReturnValue result); + void OnHostMsgGetOwnerElementObject(PP_Instance instance, SerializedVarReturnValue result); - void OnMsgDocumentCanRequest(PP_Instance instance, - SerializedVarReceiveInput url, - PP_Bool* result); - void OnMsgDocumentCanAccessDocument(PP_Instance active, - PP_Instance target, - PP_Bool* result); - void OnMsgGetDocumentURL(PP_Instance instance, - SerializedVarReturnValue result); - void OnMsgGetPluginInstanceURL(PP_Instance instance, - SerializedVarReturnValue result); + void OnHostMsgBindGraphics(PP_Instance instance, + const ppapi::HostResource& device, + PP_Bool* result); + void OnHostMsgIsFullFrame(PP_Instance instance, PP_Bool* result); + void OnHostMsgExecuteScript(PP_Instance instance, + SerializedVarReceiveInput script, + SerializedVarOutParam out_exception, + SerializedVarReturnValue result); + void OnHostMsgGetDefaultCharSet(PP_Instance instance, + SerializedVarReturnValue result); + void OnHostMsgLog(PP_Instance instance, + int log_level, + SerializedVarReceiveInput value); + void OnHostMsgLogWithSource(PP_Instance instance, + int log_level, + SerializedVarReceiveInput source, + SerializedVarReceiveInput value); + void OnHostMsgSetFullscreen(PP_Instance instance, + PP_Bool fullscreen, + PP_Bool* result); + void OnHostMsgGetScreenSize(PP_Instance instance, + PP_Bool* result, + PP_Size* size); + void OnHostMsgFlashSetFullscreen(PP_Instance instance, + PP_Bool fullscreen, + PP_Bool* result); + void OnHostMsgFlashGetScreenSize(PP_Instance instance, + PP_Bool* result, + PP_Size* size); + void OnHostMsgRequestInputEvents(PP_Instance instance, + bool is_filtering, + uint32_t event_classes); + void OnHostMsgClearInputEvents(PP_Instance instance, + uint32_t event_classes); + void OnHostMsgPostMessage(PP_Instance instance, + SerializedVarReceiveInput message); + void OnHostMsgLockMouse(PP_Instance instance); + void OnHostMsgUnlockMouse(PP_Instance instance); + void OnHostMsgResolveRelativeToDocument(PP_Instance instance, + SerializedVarReceiveInput relative, + SerializedVarReturnValue result); + void OnHostMsgDocumentCanRequest(PP_Instance instance, + SerializedVarReceiveInput url, + PP_Bool* result); + void OnHostMsgDocumentCanAccessDocument(PP_Instance active, + PP_Instance target, + PP_Bool* result); + void OnHostMsgGetDocumentURL(PP_Instance instance, + SerializedVarReturnValue result); + void OnHostMsgGetPluginInstanceURL(PP_Instance instance, + SerializedVarReturnValue result); // Host -> Plugin message handlers. - void OnMsgMouseLockComplete(PP_Instance instance, int32_t result); + void OnPluginMsgMouseLockComplete(PP_Instance instance, int32_t result); void MouseLockCompleteInHost(int32_t result, PP_Instance instance); diff --git a/ppapi/proxy/ppp_instance_proxy.cc b/ppapi/proxy/ppp_instance_proxy.cc index 28f7b78..8ad8ae4 100644 --- a/ppapi/proxy/ppp_instance_proxy.cc +++ b/ppapi/proxy/ppp_instance_proxy.cc @@ -8,6 +8,7 @@ #include "ppapi/c/pp_var.h" #include "ppapi/c/ppb_core.h" +#include "ppapi/c/ppb_fullscreen.h" #include "ppapi/c/ppp_instance.h" #include "ppapi/c/private/ppb_flash_fullscreen.h" #include "ppapi/proxy/host_dispatcher.h" @@ -16,12 +17,36 @@ #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppb_url_loader_proxy.h" #include "ppapi/shared_impl/ppapi_globals.h" +#include "ppapi/shared_impl/ppb_view_shared.h" +#include "ppapi/shared_impl/scoped_pp_resource.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppb_view_api.h" namespace ppapi { namespace proxy { namespace { +void GetFullscreenStates(PP_Instance instance, + HostDispatcher* dispatcher, + PP_Bool* fullscreen, + PP_Bool* flash_fullscreen) { + const PPB_Fullscreen* fullscreen_interface = + static_cast<const PPB_Fullscreen*>( + dispatcher->local_get_interface()(PPB_FULLSCREEN_INTERFACE)); + DCHECK(fullscreen_interface); + *fullscreen = fullscreen_interface->IsFullscreen(instance); +} + +PP_Bool IsFlashFullscreen(PP_Instance instance, + HostDispatcher* dispatcher) { + const PPB_FlashFullscreen* flash_fullscreen_interface = + static_cast<const PPB_FlashFullscreen*>( + dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE)); + DCHECK(flash_fullscreen_interface); + return flash_fullscreen_interface->IsFullscreen(instance); +} + PP_Bool DidCreate(PP_Instance instance, uint32_t argc, const char* argn[], @@ -45,26 +70,18 @@ void DidDestroy(PP_Instance instance) { new PpapiMsg_PPPInstance_DidDestroy(API_ID_PPP_INSTANCE, instance)); } -void DidChangeView(PP_Instance instance, - const PP_Rect* position, - const PP_Rect* clip) { +void DidChangeView(PP_Instance instance, PP_Resource view_resource) { HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); - const PPB_FlashFullscreen* fullscreen_interface = - static_cast<const PPB_FlashFullscreen*>( - dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE)); - DCHECK(fullscreen_interface); - const PPB_FlashFullscreen* flash_fullscreen_interface = - static_cast<const PPB_FlashFullscreen*>( - dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE)); - DCHECK(flash_fullscreen_interface); - PP_Bool fullscreen = fullscreen_interface->IsFullscreen(instance); - PP_Bool flash_fullscreen = - flash_fullscreen_interface->IsFullscreen(instance); - dispatcher->Send( - new PpapiMsg_PPPInstance_DidChangeView(API_ID_PPP_INSTANCE, - instance, *position, *clip, - fullscreen, - flash_fullscreen)); + + thunk::EnterResourceNoLock<thunk::PPB_View_API> enter(view_resource, false); + if (enter.failed()) { + NOTREACHED(); + return; + } + + dispatcher->Send(new PpapiMsg_PPPInstance_DidChangeView( + API_ID_PPP_INSTANCE, instance, enter.object()->GetData(), + IsFlashFullscreen(instance, dispatcher))); } void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) { @@ -105,7 +122,7 @@ PP_Bool HandleDocumentLoad(PP_Instance instance, return result; } -static const PPP_Instance_1_0 instance_interface_1_0 = { +static const PPP_Instance_1_1 instance_interface = { &DidCreate, &DidDestroy, &DidChangeView, @@ -113,18 +130,30 @@ static const PPP_Instance_1_0 instance_interface_1_0 = { &HandleDocumentLoad }; -InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher) { - return new PPP_Instance_Proxy(dispatcher); -} - } // namespace PPP_Instance_Proxy::PPP_Instance_Proxy(Dispatcher* dispatcher) : InterfaceProxy(dispatcher) { if (dispatcher->IsPlugin()) { - combined_interface_.reset( - new PPP_Instance_Combined(*static_cast<const PPP_Instance_1_0*>( - dispatcher->local_get_interface()(PPP_INSTANCE_INTERFACE_1_0)))); + // The PPP_Instance proxy works by always proxying the 1.1 version of the + // interface, and then detecting in the plugin process which one to use. + // PPP_Instance_Combined handles dispatching to whatever interface is + // supported. + // + // This means that if the plugin supports either 1.0 or 1.1 version of + // the interface, we want to say it supports the 1.1 version since we'll + // convert it here. This magic conversion code is hardcoded into + // PluginDispatcher::OnMsgSupportsInterface. + const PPP_Instance* instance = static_cast<const PPP_Instance*>( + dispatcher->local_get_interface()(PPP_INSTANCE_INTERFACE)); + if (instance) { + combined_interface_.reset(new PPP_Instance_Combined(*instance)); + } else { + const PPP_Instance_1_0* instance_1_0 = + static_cast<const PPP_Instance_1_0*>( + dispatcher->local_get_interface()(PPP_INSTANCE_INTERFACE_1_0)); + combined_interface_.reset(new PPP_Instance_Combined(*instance_1_0)); + } } } @@ -132,36 +161,29 @@ PPP_Instance_Proxy::~PPP_Instance_Proxy() { } // static -const InterfaceProxy::Info* PPP_Instance_Proxy::GetInfo1_0() { - static const Info info = { - &instance_interface_1_0, - PPP_INSTANCE_INTERFACE_1_0, - API_ID_PPP_INSTANCE, - false, - &CreateInstanceProxy - }; - return &info; +const PPP_Instance* PPP_Instance_Proxy::GetInstanceInterface() { + return &instance_interface; } bool PPP_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPP_Instance_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidCreate, - OnMsgDidCreate) + OnPluginMsgDidCreate) IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidDestroy, - OnMsgDidDestroy) + OnPluginMsgDidDestroy) IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidChangeView, - OnMsgDidChangeView) + OnPluginMsgDidChangeView) IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidChangeFocus, - OnMsgDidChangeFocus) + OnPluginMsgDidChangeFocus) IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_HandleDocumentLoad, - OnMsgHandleDocumentLoad) + OnPluginMsgHandleDocumentLoad) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; } -void PPP_Instance_Proxy::OnMsgDidCreate( +void PPP_Instance_Proxy::OnPluginMsgDidCreate( PP_Instance instance, const std::vector<std::string>& argn, const std::vector<std::string>& argv, @@ -195,37 +217,45 @@ void PPP_Instance_Proxy::OnMsgDidCreate( &argn_array[0], &argv_array[0]); } -void PPP_Instance_Proxy::OnMsgDidDestroy(PP_Instance instance) { +void PPP_Instance_Proxy::OnPluginMsgDidDestroy(PP_Instance instance) { combined_interface_->DidDestroy(instance); PpapiGlobals::Get()->GetResourceTracker()->DidDeleteInstance(instance); static_cast<PluginDispatcher*>(dispatcher())->DidDestroyInstance(instance); } -void PPP_Instance_Proxy::OnMsgDidChangeView(PP_Instance instance, - const PP_Rect& position, - const PP_Rect& clip, - PP_Bool fullscreen, - PP_Bool flash_fullscreen) { +void PPP_Instance_Proxy::OnPluginMsgDidChangeView( + PP_Instance instance, + const ViewData& new_data, + PP_Bool flash_fullscreen) { PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); if (!dispatcher) return; InstanceData* data = dispatcher->GetInstanceData(instance); if (!data) return; - data->position = position; - data->fullscreen = fullscreen; + + data->view = new_data; data->flash_fullscreen = flash_fullscreen; - combined_interface_->DidChangeView(instance, &position, &clip); + + ScopedPPResource resource( + ScopedPPResource::PassRef(), + (new PPB_View_Shared(PPB_View_Shared::InitAsProxy(), + instance, new_data))->GetReference()); + + combined_interface_->DidChangeView(instance, resource, + &new_data.rect, + &new_data.clip_rect); } -void PPP_Instance_Proxy::OnMsgDidChangeFocus(PP_Instance instance, - PP_Bool has_focus) { +void PPP_Instance_Proxy::OnPluginMsgDidChangeFocus(PP_Instance instance, + PP_Bool has_focus) { combined_interface_->DidChangeFocus(instance, has_focus); } -void PPP_Instance_Proxy::OnMsgHandleDocumentLoad(PP_Instance instance, - const HostResource& url_loader, - PP_Bool* result) { +void PPP_Instance_Proxy::OnPluginMsgHandleDocumentLoad( + PP_Instance instance, + const HostResource& url_loader, + PP_Bool* result) { PP_Resource plugin_loader = PPB_URLLoader_Proxy::TrackPluginResource(url_loader); *result = combined_interface_->HandleDocumentLoad(instance, plugin_loader); diff --git a/ppapi/proxy/ppp_instance_proxy.h b/ppapi/proxy/ppp_instance_proxy.h index 2fce675..1b599d0 100644 --- a/ppapi/proxy/ppp_instance_proxy.h +++ b/ppapi/proxy/ppp_instance_proxy.h @@ -19,6 +19,9 @@ struct PP_Rect; namespace ppapi { + +struct ViewData; + namespace proxy { class PPP_Instance_Proxy : public InterfaceProxy { @@ -26,8 +29,7 @@ class PPP_Instance_Proxy : public InterfaceProxy { explicit PPP_Instance_Proxy(Dispatcher* dispatcher); virtual ~PPP_Instance_Proxy(); - // Return the info for the 1.0 (latest, canonical) version of the interface. - static const Info* GetInfo1_0(); + static const PPP_Instance* GetInstanceInterface(); PPP_Instance_Combined* ppp_instance_target() const { return combined_interface_.get(); @@ -38,20 +40,18 @@ class PPP_Instance_Proxy : public InterfaceProxy { private: // Message handlers. - void OnMsgDidCreate(PP_Instance instance, - const std::vector<std::string>& argn, - const std::vector<std::string>& argv, - PP_Bool* result); - void OnMsgDidDestroy(PP_Instance instance); - void OnMsgDidChangeView(PP_Instance instance, - const PP_Rect& position, - const PP_Rect& clip, - PP_Bool fullscreen, - PP_Bool flash_fullscreen); - void OnMsgDidChangeFocus(PP_Instance instance, PP_Bool has_focus); - void OnMsgHandleDocumentLoad(PP_Instance instance, - const HostResource& url_loader, - PP_Bool* result); + void OnPluginMsgDidCreate(PP_Instance instance, + const std::vector<std::string>& argn, + const std::vector<std::string>& argv, + PP_Bool* result); + void OnPluginMsgDidDestroy(PP_Instance instance); + void OnPluginMsgDidChangeView(PP_Instance instance, + const ViewData& new_data, + PP_Bool flash_fullscreen); + void OnPluginMsgDidChangeFocus(PP_Instance instance, PP_Bool has_focus); + void OnPluginMsgHandleDocumentLoad(PP_Instance instance, + const HostResource& url_loader, + PP_Bool* result); scoped_ptr<PPP_Instance_Combined> combined_interface_; }; diff --git a/ppapi/shared_impl/ppb_view_shared.cc b/ppapi/shared_impl/ppb_view_shared.cc new file mode 100644 index 0000000..30030d4 --- /dev/null +++ b/ppapi/shared_impl/ppb_view_shared.cc @@ -0,0 +1,55 @@ +// Copyright (c) 2011 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.
+
+#include "ppapi/shared_impl/ppb_view_shared.h"
+
+namespace ppapi {
+
+ViewData::ViewData() {
+ // Assume POD.
+ memset(this, 0, sizeof(ViewData));
+}
+
+ViewData::~ViewData() {
+}
+
+bool ViewData::Equals(const ViewData& other) const {
+ return rect.point.x == other.rect.point.x &&
+ rect.point.y == other.rect.point.y &&
+ rect.size.width == other.rect.size.width &&
+ rect.size.height == other.rect.size.height &&
+ is_fullscreen == other.is_fullscreen &&
+ is_page_visible == other.is_page_visible &&
+ clip_rect.point.x == other.clip_rect.point.x &&
+ clip_rect.point.y == other.clip_rect.point.y &&
+ clip_rect.size.width == other.clip_rect.size.width &&
+ clip_rect.size.height == other.clip_rect.size.height;
+}
+
+PPB_View_Shared::PPB_View_Shared(const InitAsImpl&,
+ PP_Instance instance,
+ const ViewData& data)
+ : Resource(instance),
+ data_(data) {
+}
+
+PPB_View_Shared::PPB_View_Shared(const InitAsProxy&,
+ PP_Instance instance,
+ const ViewData& data)
+ : Resource(HostResource::MakeInstanceOnly(instance)),
+ data_(data) {
+}
+
+PPB_View_Shared::~PPB_View_Shared() {
+}
+
+thunk::PPB_View_API* PPB_View_Shared::AsPPB_View_API() {
+ return this;
+}
+
+const ViewData& PPB_View_Shared::GetData() const {
+ return data_;
+}
+
+} // namespace ppapi
diff --git a/ppapi/shared_impl/ppb_view_shared.h b/ppapi/shared_impl/ppb_view_shared.h new file mode 100644 index 0000000..6bba605 --- /dev/null +++ b/ppapi/shared_impl/ppb_view_shared.h @@ -0,0 +1,61 @@ +// Copyright (c) 2011 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 PPAPI_SHARED_IMPL_PPB_VIEW_SHARED_H_
+#define PPAPI_SHARED_IMPL_PPB_VIEW_SHARED_H_
+
+#include "base/compiler_specific.h"
+#include "ppapi/c/pp_rect.h"
+#include "ppapi/c/pp_size.h"
+#include "ppapi/shared_impl/resource.h"
+#include "ppapi/thunk/ppb_view_api.h"
+
+namespace ppapi {
+
+// If you add to this struct, be sure to update the serialization in
+// ppapi_messages.h.
+struct PPAPI_SHARED_EXPORT ViewData {
+ ViewData();
+ ~ViewData();
+
+ bool Equals(const ViewData& other) const;
+
+ PP_Rect rect;
+ bool is_fullscreen;
+ bool is_page_visible;
+ PP_Rect clip_rect;
+};
+
+class PPAPI_SHARED_EXPORT PPB_View_Shared
+ : public Resource,
+ public thunk::PPB_View_API {
+ public:
+ struct InitAsImpl {};
+ struct InitAsProxy {};
+
+ // The dummy arguments control which version of Resource's constructor is
+ // called for this base class.
+ PPB_View_Shared(const InitAsImpl&,
+ PP_Instance instance,
+ const ViewData& data);
+ PPB_View_Shared(const InitAsProxy&,
+ PP_Instance instance,
+ const ViewData& data);
+ virtual ~PPB_View_Shared();
+
+ // Resource overrides.
+ virtual thunk::PPB_View_API* AsPPB_View_API() OVERRIDE;
+
+ // PPB_View_API implementation.
+ virtual const ViewData& GetData() const OVERRIDE;
+
+ private:
+ ViewData data_;
+
+ DISALLOW_COPY_AND_ASSIGN(PPB_View_Shared);
+};
+
+} // namespace ppapi
+
+#endif // PPAPI_SHARED_IMPL_PPB_VIEW_SHARED_H_
diff --git a/ppapi/shared_impl/ppp_instance_combined.cc b/ppapi/shared_impl/ppp_instance_combined.cc index 1ec928e..ebadcd1f 100644 --- a/ppapi/shared_impl/ppp_instance_combined.cc +++ b/ppapi/shared_impl/ppp_instance_combined.cc @@ -1,15 +1,57 @@ -// Copyright (c) 2011 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. - -#include "ppapi/shared_impl/ppp_instance_combined.h" - -namespace ppapi { - -PPP_Instance_Combined::PPP_Instance_Combined( - const PPP_Instance_1_0& instance_if) - : PPP_Instance_1_0(instance_if) { -} - -} // namespace ppapi - +// Copyright (c) 2011 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.
+
+#include "ppapi/shared_impl/ppp_instance_combined.h"
+
+namespace ppapi {
+
+PPP_Instance_Combined::PPP_Instance_Combined(
+ const PPP_Instance_1_0& instance_if)
+ : did_change_view_1_0_(instance_if.DidChangeView) {
+ instance_1_1_.DidCreate = instance_if.DidCreate;
+ instance_1_1_.DidDestroy = instance_if.DidDestroy;
+ instance_1_1_.DidChangeView = NULL;
+ instance_1_1_.DidChangeFocus = instance_if.DidChangeFocus;
+ instance_1_1_.HandleDocumentLoad = instance_if.HandleDocumentLoad;
+}
+
+PPP_Instance_Combined::PPP_Instance_Combined(
+ const PPP_Instance_1_1& instance_if)
+ : instance_1_1_(instance_if),
+ did_change_view_1_0_(NULL) {
+}
+
+PP_Bool PPP_Instance_Combined::DidCreate(PP_Instance instance,
+ uint32_t argc,
+ const char* argn[],
+ const char* argv[]) {
+ return instance_1_1_.DidCreate(instance, argc, argn, argv);
+}
+
+void PPP_Instance_Combined::DidDestroy(PP_Instance instance) {
+ return instance_1_1_.DidDestroy(instance);
+}
+
+void PPP_Instance_Combined::DidChangeView(PP_Instance instance,
+ PP_Resource view_changed_resource,
+ const struct PP_Rect* position,
+ const struct PP_Rect* clip) {
+ if (instance_1_1_.DidChangeView)
+ instance_1_1_.DidChangeView(instance, view_changed_resource);
+ else
+ did_change_view_1_0_(instance, position, clip);
+}
+
+void PPP_Instance_Combined::DidChangeFocus(PP_Instance instance,
+ PP_Bool has_focus) {
+ instance_1_1_.DidChangeFocus(instance, has_focus);
+}
+
+PP_Bool PPP_Instance_Combined::HandleDocumentLoad(PP_Instance instance,
+ PP_Resource url_loader) {
+ return instance_1_1_.HandleDocumentLoad(instance, url_loader);
+}
+
+} // namespace ppapi
+
diff --git a/ppapi/shared_impl/ppp_instance_combined.h b/ppapi/shared_impl/ppp_instance_combined.h index 3daf727..7bb229f 100644 --- a/ppapi/shared_impl/ppp_instance_combined.h +++ b/ppapi/shared_impl/ppp_instance_combined.h @@ -11,9 +11,40 @@ namespace ppapi { -struct PPAPI_SHARED_EXPORT PPP_Instance_Combined : public PPP_Instance_1_0 { +// This exposes the 1.1 interface and forwards it to the 1.0 interface is +// necessary. +struct PPAPI_SHARED_EXPORT PPP_Instance_Combined { public: explicit PPP_Instance_Combined(const PPP_Instance_1_0& instance_if); + explicit PPP_Instance_Combined(const PPP_Instance_1_1& instance_if); + + PP_Bool DidCreate(PP_Instance instance, + uint32_t argc, + const char* argn[], + const char* argv[]); + void DidDestroy(PP_Instance instance); + + // This version of DidChangeView encapsulates all arguments for both 1.0 + // and 1.1 versions of this function. Conversion from 1.1 -> 1.0 is easy, + // but this class doesn't have the necessary context (resource interfaces) + // to do the conversion, so the caller must do it. + void DidChangeView(PP_Instance instance, + PP_Resource view_changed_resource, + const struct PP_Rect* position, + const struct PP_Rect* clip); + + void DidChangeFocus(PP_Instance instance, PP_Bool has_focus); + PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader); + + private: + // For version 1.0, DidChangeView will be NULL, and DidChangeView_1_0 will + // be set below. + PPP_Instance_1_1 instance_1_1_; + + // Non-NULL when Instance 1.0 is used. + void (*did_change_view_1_0_)(PP_Instance instance, + const struct PP_Rect* position, + const struct PP_Rect* clip); DISALLOW_COPY_AND_ASSIGN(PPP_Instance_Combined); }; diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h index df4415c..11038fa 100644 --- a/ppapi/shared_impl/resource.h +++ b/ppapi/shared_impl/resource.h @@ -49,6 +49,7 @@ F(PPB_VideoCapture_API) \ F(PPB_VideoDecoder_API) \ F(PPB_VideoLayer_API) \ + F(PPB_View_API) \ F(PPB_WebSocket_API) \ F(PPB_Widget_API) diff --git a/ppapi/thunk/interfaces_ppb_public_stable.h b/ppapi/thunk/interfaces_ppb_public_stable.h index f4d5ec3..56498d8 100644 --- a/ppapi/thunk/interfaces_ppb_public_stable.h +++ b/ppapi/thunk/interfaces_ppb_public_stable.h @@ -74,5 +74,6 @@ PROXIED_IFACE(NoAPIName, PPB_URLREQUESTINFO_INTERFACE_1_0, PPB_URLRequestInfo) PROXIED_IFACE(PPB_URLResponseInfo, PPB_URLRESPONSEINFO_INTERFACE_1_0, PPB_URLResponseInfo) // Note: PPB_Var is special and registered manually. +PROXIED_IFACE(NoAPIName, PPB_VIEW_INTERFACE_1_0, PPB_View) #include "ppapi/thunk/interfaces_postamble.h" diff --git a/ppapi/thunk/ppb_audio_api.h b/ppapi/thunk/ppb_audio_api.h index 8d3a0b8..3c9c274 100644 --- a/ppapi/thunk/ppb_audio_api.h +++ b/ppapi/thunk/ppb_audio_api.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef PPAPI_THUNK_AUDIO_API_H_ -#define PPAPI_THUNK_AUDIO_API_H_ +#ifndef PPAPI_THUNK_PPB_AUDIO_API_H_ +#define PPAPI_THUNK_PPB_AUDIO_API_H_ #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/ppb_audio.h" @@ -30,4 +30,4 @@ class PPAPI_THUNK_EXPORT PPB_Audio_API { } // namespace thunk } // namespace ppapi -#endif // PPAPI_THUNK_AUDIO_API_H_ +#endif // PPAPI_THUNK_PPB_AUDIO_API_H_ diff --git a/ppapi/thunk/ppb_fullscreen_thunk.cc b/ppapi/thunk/ppb_fullscreen_thunk.cc index 4c5626e..5f2a0e0 100644 --- a/ppapi/thunk/ppb_fullscreen_thunk.cc +++ b/ppapi/thunk/ppb_fullscreen_thunk.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "ppapi/c/ppb_fullscreen.h" +#include "ppapi/shared_impl/ppb_view_shared.h" #include "ppapi/thunk/thunk.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/ppb_instance_api.h" @@ -17,7 +18,10 @@ PP_Bool IsFullscreen(PP_Instance instance) { EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true); if (enter.failed()) return PP_FALSE; - return enter.functions()->IsFullscreen(instance); + const ViewData* view = enter.functions()->GetViewData(instance); + if (!view) + return PP_FALSE; + return PP_FromBool(view->is_fullscreen); } PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) { diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h index 21187c4..8151479 100644 --- a/ppapi/thunk/ppb_instance_api.h +++ b/ppapi/thunk/ppb_instance_api.h @@ -19,6 +19,9 @@ #endif namespace ppapi { + +struct ViewData; + namespace thunk { class PPB_Instance_FunctionAPI { @@ -28,6 +31,9 @@ class PPB_Instance_FunctionAPI { virtual PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) = 0; virtual PP_Bool IsFullFrame(PP_Instance instance) = 0; + // Not an exposed PPAPI function, this returns the internal view data struct. + virtual const ViewData* GetViewData(PP_Instance instance) = 0; + // InstancePrivate. virtual PP_Var GetWindowObject(PP_Instance instance) = 0; virtual PP_Var GetOwnerElementObject(PP_Instance instance) = 0; @@ -55,7 +61,6 @@ class PPB_Instance_FunctionAPI { int32_t index) = 0; // Fullscreen. - virtual PP_Bool IsFullscreen(PP_Instance instance) = 0; virtual PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) = 0; virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) = 0; diff --git a/ppapi/thunk/ppb_view_api.h b/ppapi/thunk/ppb_view_api.h new file mode 100644 index 0000000..377658a --- /dev/null +++ b/ppapi/thunk/ppb_view_api.h @@ -0,0 +1,31 @@ +// Copyright (c) 2011 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 PPAPI_THUNK_PPB_VIEW_API_H_
+#define PPAPI_THUNK_PPB_VIEW_API_H_
+
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+struct ViewData;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_View_API {
+ public:
+ virtual ~PPB_View_API() {}
+
+ // Returns the view data struct. We could have virtual functions here for
+ // each PPAPI function, but that would be more boilerplate for these simple
+ // getters so the logic is implemented in the thunk layer. If we start
+ // autogenerating the thunk layer and need this to be more regular, adding
+ // the API functions here should be fine.
+ virtual const ViewData& GetData() const = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_VIEW_API_H_
diff --git a/ppapi/thunk/ppb_view_thunk.cc b/ppapi/thunk/ppb_view_thunk.cc new file mode 100644 index 0000000..2615fea --- /dev/null +++ b/ppapi/thunk/ppb_view_thunk.cc @@ -0,0 +1,96 @@ +// Copyright (c) 2011 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.
+
+#include "ppapi/c/ppb_view.h"
+#include "ppapi/shared_impl/ppb_view_shared.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_view_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_View_API> EnterView;
+
+bool IsRectVisible(const PP_Rect& rect) {
+ return rect.size.width > 0 && rect.size.height > 0;
+}
+
+PP_Bool IsView(PP_Resource resource) {
+ EnterView enter(resource, false);
+ return enter.succeeded() ? PP_TRUE : PP_FALSE;
+}
+
+PP_Bool GetSize(PP_Resource resource, PP_Size* size) {
+ EnterView enter(resource, true);
+ if (enter.failed() || !size)
+ return PP_FALSE;
+ *size = enter.object()->GetData().rect.size;
+ return PP_TRUE;
+}
+
+PP_Bool GetRect(PP_Resource resource, PP_Rect* viewport) {
+ EnterView enter(resource, true);
+ if (enter.failed() || !viewport)
+ return PP_FALSE;
+ *viewport = enter.object()->GetData().rect;
+ return PP_TRUE;
+}
+
+PP_Bool IsFullscreen(PP_Resource resource) {
+ EnterView enter(resource, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return PP_FromBool(enter.object()->GetData().is_fullscreen);
+}
+
+PP_Bool IsUserVisible(PP_Resource resource) {
+ EnterView enter(resource, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return PP_FromBool(enter.object()->GetData().is_page_visible &&
+ IsRectVisible(enter.object()->GetData().clip_rect));
+}
+
+PP_Bool IsPageVisible(PP_Resource resource) {
+ EnterView enter(resource, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return PP_FromBool(enter.object()->GetData().is_page_visible);
+}
+
+PP_Bool IsClipVisible(PP_Resource resource) {
+ EnterView enter(resource, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return PP_FromBool(IsRectVisible(enter.object()->GetData().clip_rect));
+}
+
+PP_Bool GetClipRect(PP_Resource resource, PP_Rect* clip) {
+ EnterView enter(resource, true);
+ if (enter.failed() || !clip)
+ return PP_FALSE;
+ *clip = enter.object()->GetData().clip_rect;
+ return PP_TRUE;
+}
+
+const PPB_View g_ppb_view_thunk = {
+ &IsView,
+ &GetRect,
+ &IsFullscreen,
+ &IsUserVisible,
+ &IsPageVisible,
+ &GetClipRect
+};
+
+} // namespace
+
+const PPB_View* GetPPB_View_Thunk() {
+ return &g_ppb_view_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/thunk.h b/ppapi/thunk/thunk.h index 00773f3..a6a6ebb 100644 --- a/ppapi/thunk/thunk.h +++ b/ppapi/thunk/thunk.h @@ -43,8 +43,6 @@ struct PPB_TCPSocket_Private; struct PPB_UDPSocket_Private; struct PPB_URLLoaderTrusted; -typedef PPB_Instance PPB_Instance_1_0; - namespace ppapi { namespace thunk { diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index ca2bae9..e46f135 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -231,6 +231,7 @@ '../plugins/ppapi/file_path.cc', '../plugins/ppapi/file_path.h', '../plugins/ppapi/fullscreen_container.h', + '../plugins/ppapi/gfx_conversion.h', '../plugins/ppapi/host_array_buffer_var.cc', '../plugins/ppapi/host_array_buffer_var.h', '../plugins/ppapi/host_globals.cc', diff --git a/webkit/plugins/ppapi/gfx_conversion.h b/webkit/plugins/ppapi/gfx_conversion.h new file mode 100644 index 0000000..ad4006b --- /dev/null +++ b/webkit/plugins/ppapi/gfx_conversion.h @@ -0,0 +1,48 @@ +// Copyright (c) 2011 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 WEBKIT_PLUGINS_PPAPI_GFX_CONVERSION_H_
+#define WEBKIT_PLUGINS_PPAPI_GFX_CONVERSION_H_
+
+#include "ppapi/c/pp_point.h"
+#include "ppapi/c/pp_rect.h"
+#include "ppapi/c/pp_size.h"
+#include "ui/gfx/point.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/size.h"
+
+// Conversions for graphics types between our gfx library and PPAPI.
+// The style of naming is to match the PP_Bool conversions.
+
+namespace webkit {
+namespace ppapi {
+
+inline gfx::Point PP_ToGfxPoint(const PP_Point& p) {
+ return gfx::Point(p.x, p.y);
+}
+
+inline PP_Point PP_FromGfxPoint(const gfx::Point& p) {
+ return PP_MakePoint(p.x(), p.y());
+}
+
+inline gfx::Rect PP_ToGfxRect(const PP_Rect& r) {
+ return gfx::Rect(r.point.x, r.point.y, r.size.width, r.size.height);
+}
+
+inline PP_Rect PP_FromGfxRect(const gfx::Rect& r) {
+ return PP_MakeRectFromXYWH(r.x(), r.y(), r.width(), r.height());
+}
+
+inline gfx::Size PP_ToGfxSize(const PP_Size& s) {
+ return gfx::Size(s.width, s.height);
+}
+
+inline PP_Size PP_FromGfxSize(const gfx::Size& s) {
+ return PP_MakeSize(s.width(), s.height());
+}
+
+} // namespace ppapi
+} // namespace webkit
+
+#endif // WEBKIT_PLUGINS_PPAPI_GFX_CONVERSION_H_
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index 3e08385d..2340200 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -60,6 +60,7 @@ #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" #include "ppapi/c/ppb_var.h" +#include "ppapi/c/ppb_view.h" #include "ppapi/c/ppp.h" #include "ppapi/c/ppp_instance.h" #include "ppapi/c/private/ppb_file_ref_private.h" @@ -513,10 +514,14 @@ PluginModule::GetInterfaceFunc PluginModule::GetLocalGetInterfaceFunc() { PluginInstance* PluginModule::CreateInstance(PluginDelegate* delegate) { PluginInstance* instance(NULL); - const void* ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_1_0); + const void* ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_1_1); if (ppp_instance) { + instance = PluginInstance::Create1_1(delegate, this, ppp_instance); + } else if ((ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_1_0))) { instance = PluginInstance::Create1_0(delegate, this, ppp_instance); - } if (!instance) { + } + + if (!instance) { LOG(WARNING) << "Plugin doesn't support instance interface, failing."; return NULL; } diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index 9229d10..c5c52ce 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -27,7 +27,10 @@ #include "ppapi/c/private/ppp_instance_private.h" #include "ppapi/shared_impl/ppb_input_event_shared.h" #include "ppapi/shared_impl/ppb_url_util_shared.h" +#include "ppapi/shared_impl/ppb_view_shared.h" #include "ppapi/shared_impl/ppp_instance_combined.h" +#include "ppapi/shared_impl/resource.h" +#include "ppapi/shared_impl/scoped_pp_resource.h" #include "ppapi/shared_impl/time_conversion.h" #include "ppapi/shared_impl/var.h" #include "ppapi/thunk/enter.h" @@ -52,6 +55,7 @@ #include "webkit/plugins/ppapi/common.h" #include "webkit/plugins/ppapi/event_conversion.h" #include "webkit/plugins/ppapi/fullscreen_container.h" +#include "webkit/plugins/ppapi/gfx_conversion.h" #include "webkit/plugins/ppapi/host_globals.h" #include "webkit/plugins/ppapi/message_channel.h" #include "webkit/plugins/ppapi/npapi_glue.h" @@ -91,6 +95,8 @@ using base::StringPrintf; using ppapi::InputEventData; using ppapi::PPB_InputEvent_Shared; using ppapi::PpapiGlobals; +using ppapi::PPB_View_Shared; +using ppapi::ScopedPPResource; using ppapi::StringVar; using ppapi::thunk::EnterResourceNoLock; using ppapi::thunk::PPB_Buffer_API; @@ -99,6 +105,7 @@ using ppapi::thunk::PPB_Graphics3D_API; using ppapi::thunk::PPB_ImageData_API; using ppapi::thunk::PPB_Instance_FunctionAPI; using ppapi::Var; +using ppapi::ViewData; using WebKit::WebBindings; using WebKit::WebCanvas; using WebKit::WebConsoleMessage; @@ -219,11 +226,6 @@ COMPILE_ASSERT_MATCHING_ENUM(TypeGrabbing, PP_CURSORTYPE_GRABBING); // Do not assert WebCursorInfo::TypeCustom == PP_CURSORTYPE_CUSTOM; // PP_CURSORTYPE_CUSTOM is pinned to allow new cursor types. -void RectToPPRect(const gfx::Rect& input, PP_Rect* output) { - *output = PP_MakeRectFromXYWH(input.x(), input.y(), - input.width(), input.height()); -} - // Sets |*security_origin| to be the WebKit security origin associated with the // document containing the given plugin instance. On success, returns true. If // the instance is invalid, returns false and |*security_origin| will be @@ -253,6 +255,18 @@ PluginInstance* PluginInstance::Create1_0(PluginDelegate* delegate, new ::ppapi::PPP_Instance_Combined(*instance)); } +// static +PluginInstance* PluginInstance::Create1_1(PluginDelegate* delegate, + PluginModule* module, + const void* ppp_instance_if_1_1) { + const PPP_Instance_1_1* instance = + static_cast<const PPP_Instance_1_1*>(ppp_instance_if_1_1); + return new PluginInstance( + delegate, + module, + new ::ppapi::PPP_Instance_Combined(*instance)); +} + PluginInstance::PluginInstance( PluginDelegate* delegate, PluginModule* module, @@ -263,7 +277,8 @@ PluginInstance::PluginInstance( pp_instance_(0), container_(NULL), full_frame_(false), - sent_did_change_view_(false), + sent_initial_did_change_view_(false), + suppress_did_change_view_(false), has_webkit_focus_(false), has_content_area_focus_(false), find_identifier_(-1), @@ -283,7 +298,6 @@ PluginInstance::PluginInstance( fullscreen_container_(NULL), flash_fullscreen_(false), desired_fullscreen_state_(false), - fullscreen_(false), message_channel_(NULL), sad_plugin_(NULL), input_event_mask_(0), @@ -368,7 +382,8 @@ void PluginInstance::InvalidateRect(const gfx::Rect& rect) { else fullscreen_container_->InvalidateRect(rect); } else { - if (!container_ || position_.IsEmpty()) + if (!container_ || + view_data_.rect.size.width == 0 || view_data_.rect.size.height == 0) return; // Nothing to do. if (rect.IsEmpty()) container_->invalidate(); @@ -630,7 +645,9 @@ bool PluginInstance::IsPluginAcceptingCompositionEvents() const { gfx::Rect PluginInstance::GetCaretBounds() const { if (!text_input_caret_set_) { // If it is never set by the plugin, use the bottom left corner. - return gfx::Rect(position().x(), position().y()+position().height(), 0, 0); + return gfx::Rect(view_data_.rect.point.x, + view_data_.rect.point.y + view_data_.rect.size.height, + 0, 0); } // TODO(kinaba) Take CSS transformation into accont. @@ -639,7 +656,7 @@ gfx::Rect PluginInstance::GetCaretBounds() const { // passed to IME. Currently, we pass only the caret rectangle because // it is the only information supported uniformly in Chromium. gfx::Rect caret(text_input_caret_); - caret.Offset(position().origin()); + caret.Offset(view_data_.rect.point.x, view_data_.rect.point.y); return caret; } @@ -720,41 +737,41 @@ void PluginInstance::ViewChanged(const gfx::Rect& position, if (!clip.IsEmpty()) new_clip = clip; - // Don't notify the plugin if we've already sent these same params before. - if (sent_did_change_view_ && position == position_ && new_clip == clip_) - return; + ViewData previous_view = view_data_; + + view_data_.rect = PP_FromGfxRect(position); + view_data_.clip_rect = PP_FromGfxRect(clip); - if (desired_fullscreen_state_ || fullscreen_) { + if (desired_fullscreen_state_ || view_data_.is_fullscreen) { WebElement element = container_->element(); WebDocument document = element.document(); bool is_fullscreen_element = (element == document.fullScreenElement()); - if (!fullscreen_ && desired_fullscreen_state_ && + if (!view_data_.is_fullscreen && desired_fullscreen_state_ && delegate()->IsInFullscreenMode() && is_fullscreen_element) { // Entered fullscreen. Only possible via SetFullscreen(). - fullscreen_ = true; - } else if (fullscreen_ && !is_fullscreen_element) { + view_data_.is_fullscreen = true; + } else if (view_data_.is_fullscreen && !is_fullscreen_element) { // Exited fullscreen. Possible via SetFullscreen() or F11/link, // so desired_fullscreen_state might be out-of-date. desired_fullscreen_state_ = false; - fullscreen_ = false; + view_data_.is_fullscreen = false; + + // This operation will cause the plugin to re-layout which will send more + // DidChangeView updates. Schedule an asynchronous update and suppress + // notifications until that completes to avoid sending intermediate sizes + // to the plugins. + ScheduleAsyncDidChangeView(previous_view); + // Reset the size attributes that we hacked to fill in the screen and // retrigger ViewChanged. Make sure we don't forward duplicates of // this view to the plugin. ResetSizeAttributesAfterFullscreen(); - SetSentDidChangeView(position, new_clip); - MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(&PluginInstance::ReportGeometry, this)); return; } } - SetSentDidChangeView(position, new_clip); flash_fullscreen_ = (fullscreen_container_ != NULL); - - PP_Rect pp_position, pp_clip; - RectToPPRect(position_, &pp_position); - RectToPPRect(clip_, &pp_clip); - instance_interface_->DidChangeView(pp_instance(), &pp_position, &pp_clip); + SendDidChangeView(previous_view); } void PluginInstance::SetWebKitFocus(bool has_focus) { @@ -812,11 +829,12 @@ bool PluginInstance::GetBitmapForOptimizedPluginPaint( // store when seeing if we cover the given paint bounds, since the backing // store could be smaller than the declared plugin area. PPB_ImageData_Impl* image_data = GetBoundGraphics2D()->image_data(); - gfx::Rect plugin_backing_store_rect(position_.origin(), - gfx::Size(image_data->width(), - image_data->height())); - gfx::Rect clip_page(clip_); - clip_page.Offset(position_.origin()); + gfx::Rect plugin_backing_store_rect( + PP_ToGfxPoint(view_data_.rect.point), + gfx::Size(image_data->width(), image_data->height())); + + gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect); + clip_page.Offset(PP_ToGfxPoint(view_data_.rect.point)); gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); if (!plugin_paint_rect.Contains(paint_bounds)) return false; @@ -993,6 +1011,38 @@ bool PluginInstance::PluginHasFocus() const { return has_webkit_focus_ && has_content_area_focus_; } +void PluginInstance::ScheduleAsyncDidChangeView( + const ::ppapi::ViewData& previous_view) { + if (suppress_did_change_view_) + return; // Already scheduled. + suppress_did_change_view_ = true; + MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&PluginInstance::SendAsyncDidChangeView, + this, previous_view)); +} + +void PluginInstance::SendAsyncDidChangeView(const ViewData& previous_view) { + DCHECK(suppress_did_change_view_); + suppress_did_change_view_ = false; + SendDidChangeView(previous_view); +} + +void PluginInstance::SendDidChangeView(const ViewData& previous_view) { + if (suppress_did_change_view_ || + (sent_initial_did_change_view_ && previous_view.Equals(view_data_))) + return; // Nothing to update. + + sent_initial_did_change_view_ = true; + ScopedPPResource resource( + ScopedPPResource::PassRef(), + (new PPB_View_Shared(PPB_View_Shared::InitAsImpl(), + pp_instance(), view_data_))->GetReference()); + + instance_interface_->DidChangeView(pp_instance(), resource, + &view_data_.rect, + &view_data_.clip_rect); +} + void PluginInstance::ReportGeometry() { // If this call was delayed, we may have transitioned back to fullscreen in // the mean time, so only report the geometry if we are actually in normal @@ -1045,7 +1095,7 @@ int PluginInstance::PrintBegin(const gfx::Rect& printable_area, int num_pages = 0; PP_PrintSettings_Dev print_settings; - RectToPPRect(printable_area, &print_settings.printable_area); + print_settings.printable_area = PP_FromGfxRect(printable_area); print_settings.dpi = printer_dpi; print_settings.orientation = PP_PRINTORIENTATION_NORMAL; print_settings.grayscale = PP_FALSE; @@ -1151,7 +1201,7 @@ bool PluginInstance::SetFullscreen(bool fullscreen) { // Check whether we are trying to switch while the state is in transition. // The 2nd request gets dropped while messing up the internal state, so // disallow this. - if (fullscreen_ != desired_fullscreen_state_) + if (view_data_.is_fullscreen != desired_fullscreen_state_) return false; // The browser will allow us to go into fullscreen mode only when processing @@ -1582,8 +1632,8 @@ void PluginInstance::SimulateInputEvent(const InputEventData& input_event) { std::vector<linked_ptr<WebInputEvent> > events = CreateSimulatedWebInputEvents( input_event, - position().x() + position().width() / 2, - position().y() + position().height() / 2); + view_data_.rect.point.x + view_data_.rect.size.width / 2, + view_data_.rect.point.y + view_data_.rect.size.height / 2); for (std::vector<linked_ptr<WebInputEvent> >::iterator it = events.begin(); it != events.end(); ++it) { web_view->handleInputEvent(*it->get()); @@ -1615,7 +1665,7 @@ PP_Bool PluginInstance::BindGraphics(PP_Instance instance, // Refuse to bind if in transition to fullscreen with PPB_FlashFullscreen or // to/from fullscreen with PPB_Fullscreen. if ((fullscreen_container_ && !flash_fullscreen_) || - desired_fullscreen_state_ != fullscreen_) + desired_fullscreen_state_ != view_data_.is_fullscreen) return PP_FALSE; EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false); @@ -1656,6 +1706,10 @@ PP_Bool PluginInstance::IsFullFrame(PP_Instance instance) { return PP_FromBool(full_frame()); } +const ViewData* PluginInstance::GetViewData(PP_Instance instance) { + return &view_data_; +} + PP_Var PluginInstance::GetWindowObject(PP_Instance instance) { if (!container_) return PP_MakeUndefined(); @@ -1779,10 +1833,6 @@ void PluginInstance::SelectedFindResultChanged(PP_Instance instance, delegate_->SelectedFindResultChanged(find_identifier_, index); } -PP_Bool PluginInstance::IsFullscreen(PP_Instance instance) { - return PP_FromBool(fullscreen_); -} - PP_Bool PluginInstance::FlashIsFullscreen(PP_Instance instance) { return PP_FromBool(flash_fullscreen_); } @@ -1957,13 +2007,6 @@ bool PluginInstance::CanAccessMainFrame() const { main_document.securityOrigin()); } -void PluginInstance::SetSentDidChangeView(const gfx::Rect& position, - const gfx::Rect& clip) { - sent_did_change_view_ = true; - position_ = position; - clip_ = clip; -} - void PluginInstance::KeepSizeAttributesBeforeFullscreen() { WebElement element = container_->element(); width_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kWidth)); diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h index 2dfc21d..bb43a9d 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.h +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h @@ -24,6 +24,7 @@ #include "ppapi/c/ppb_input_event.h" #include "ppapi/shared_impl/function_group_base.h" #include "ppapi/shared_impl/ppb_instance_shared.h" +#include "ppapi/shared_impl/ppb_view_shared.h" #include "ppapi/thunk/ppb_instance_api.h" #include "third_party/skia/include/core/SkRefCnt.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" @@ -85,10 +86,13 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : public ::ppapi::PPB_Instance_Shared { public: // Create and return a PluginInstance object which supports the - // PPP_Instance_1_0 interface. + // given version. static PluginInstance* Create1_0(PluginDelegate* delegate, PluginModule* module, const void* ppp_instance_if_1_0); + static PluginInstance* Create1_1(PluginDelegate* delegate, + PluginModule* module, + const void* ppp_instance_if_1_1); // Delete should be called by the WebPlugin before this destructor. virtual ~PluginInstance(); @@ -99,9 +103,6 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : WebKit::WebPluginContainer* container() const { return container_; } - const gfx::Rect& position() const { return position_; } - const gfx::Rect& clip() const { return clip_; } - void set_always_on_top(bool on_top) { always_on_top_ = on_top; } // Returns the PP_Instance uniquely identifying this instance. Guaranteed @@ -144,6 +145,7 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : // PPB_Instance and PPB_Instance_Private implementation. const GURL& plugin_url() const { return plugin_url_; } bool full_frame() const { return full_frame_; } + const ::ppapi::ViewData& view_data() const { return view_data_; } // If |type| is not PP_CURSORTYPE_CUSTOM, |custom_image| and |hot_spot| are // ignored. bool SetCursor(PP_CursorType_Dev type, @@ -306,6 +308,7 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : virtual PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) OVERRIDE; virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE; + virtual const ::ppapi::ViewData* GetViewData(PP_Instance instance) OVERRIDE; virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE; virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE; virtual PP_Var ExecuteScript(PP_Instance instance, @@ -329,7 +332,6 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : PP_Bool fullscreen) OVERRIDE; virtual PP_Bool FlashGetScreenSize(PP_Instance instance, PP_Size* size) OVERRIDE; - virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE; virtual PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) OVERRIDE; virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) @@ -384,6 +386,10 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : // (see has_webkit_focus_ below). bool PluginHasFocus() const; + void ScheduleAsyncDidChangeView(const ::ppapi::ViewData& previous_view); + void SendAsyncDidChangeView(const ::ppapi::ViewData& previous_view); + void SendDidChangeView(const ::ppapi::ViewData& previous_view); + // Reports the current plugin geometry to the plugin by calling // DidChangeView. void ReportGeometry(); @@ -444,9 +450,6 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : // compositing path. bool IsViewAccelerated(); - // Remember view parameters that were sent to the plugin. - void SetSentDidChangeView(const gfx::Rect& position, const gfx::Rect& clip); - // Track, set and reset size attributes to control the size of the plugin // in and out of fullscreen mode. void KeepSizeAttributesBeforeFullscreen(); @@ -469,20 +472,19 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : // an entire document rather than an embed tag. bool full_frame_; + // Stores the current state of the plugin view. + ::ppapi::ViewData view_data_; + // Indicates if we've ever sent a didChangeView to the plugin. This ensure we // always send an initial notification, even if the position and clip are the // same as the default values. - bool sent_did_change_view_; - - // Position in the viewport (which moves as the page is scrolled) of this - // plugin. This will be a 0-sized rectangle if the plugin has not yet been - // laid out. - gfx::Rect position_; + bool sent_initial_did_change_view_; - // Current clip rect. This will be empty if the plugin is not currently - // visible. This is in the plugin's coordinate system, so fully visible will - // be (0, 0, w, h) regardless of scroll position. - gfx::Rect clip_; + // Set to true when we've scheduled an asynchronous DidChangeView update for + // the purposes of consolidating updates. When this is set, code should + // update the view_data_ but not send updates. It will be cleared once the + // asynchronous update has been sent out. + bool suppress_did_change_view_; // The current device context for painting in 2D or 3D. scoped_refptr< ::ppapi::Resource> bound_graphics_; @@ -556,8 +558,9 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : // flash_fullscreen_ is false (see above). FullscreenContainer* fullscreen_container_; - // True if we are in fullscreen mode. False if we are in normal mode or - // in transition to fullscreen. + // True if we are in "flash" fullscreen mode. False if we are in normal mode + // or in transition to fullscreen. Normal fullscreen mode is indicated in + // the ViewData. bool flash_fullscreen_; // Implementation of PPB_Fullscreen. @@ -568,10 +571,6 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : // fullscreen. bool desired_fullscreen_state_; - // True if we are in fullscreen mode. False if we are in normal mode. - // It reflects the previous state when in transition. - bool fullscreen_; - // WebKit does not resize the plugin when going into fullscreen mode, so we do // this here by modifying the various plugin attributes and then restoring // them on exit. diff --git a/webkit/plugins/ppapi/ppapi_unittest.cc b/webkit/plugins/ppapi/ppapi_unittest.cc index d2bc625..e245727 100644 --- a/webkit/plugins/ppapi/ppapi_unittest.cc +++ b/webkit/plugins/ppapi/ppapi_unittest.cc @@ -38,9 +38,7 @@ PP_Bool Instance_DidCreate(PP_Instance pp_instance, void Instance_DidDestroy(PP_Instance instance) { } -void Instance_DidChangeView(PP_Instance pp_instance, - const PP_Rect* position, - const PP_Rect* clip) { +void Instance_DidChangeView(PP_Instance pp_instance, PP_Resource view) { } void Instance_DidChangeFocus(PP_Instance pp_instance, PP_Bool has_focus) { diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc index a209e1f..dec85d0 100644 --- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc +++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc @@ -22,6 +22,7 @@ #include "ui/gfx/point.h" #include "ui/gfx/rect.h" #include "webkit/plugins/ppapi/common.h" +#include "webkit/plugins/ppapi/gfx_conversion.h" #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" #include "webkit/plugins/ppapi/ppb_image_data_impl.h" #include "webkit/plugins/ppapi/resource_helper.h" @@ -330,7 +331,8 @@ int32_t PPB_Graphics2D_Impl::Flush(PP_CompletionCallback callback) { // ViewInitiatedPaint/ViewFlushedPaint calls, leaving our callback stranded. gfx::Rect visible_changed_rect; if (bound_instance_ && !op_rect.IsEmpty()) - visible_changed_rect = bound_instance_->clip().Intersect(op_rect); + visible_changed_rect =PP_ToGfxRect(bound_instance_->view_data().clip_rect). + Intersect(op_rect); if (bound_instance_ && !visible_changed_rect.IsEmpty()) { if (operation.type == QueuedOperation::SCROLL) { |