diff options
author | Ben Murdoch <benm@google.com> | 2014-04-03 12:29:45 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2014-04-03 12:29:45 +0100 |
commit | e5d81f57cb97b3b6b7fccc9c5610d21eb81db09d (patch) | |
tree | f266aab56db899073b21c1edd1d0e00055b9a2cf /ppapi | |
parent | 67e8dac6e410a019f58fc452b262a184e8e7fd12 (diff) | |
download | chromium_org-e5d81f57cb97b3b6b7fccc9c5610d21eb81db09d.tar.gz |
Merge from Chromium at DEPS revision 261286
This commit was generated by merge_to_master.py.
Change-Id: Iea9643ce91618057f128e9a5b62c07be152f2b89
Diffstat (limited to 'ppapi')
30 files changed, 152 insertions, 741 deletions
diff --git a/ppapi/api/dev/ppb_graphics_2d_dev.idl b/ppapi/api/dev/ppb_graphics_2d_dev.idl deleted file mode 100644 index 28a844416a..0000000000 --- a/ppapi/api/dev/ppb_graphics_2d_dev.idl +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (c) 2012 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. - */ - -/* This file contains the <code>PPB_Graphics2D_Dev</code> interface. */ - -[generate_thunk] - -label Chrome { - M22 = 0.1, - M32 = 0.2 -}; - -/** - * These options affect how the existing graphics context is displayed when a - * plugin is resized. - */ -[assert_size(4)] -enum PP_Graphics2D_Dev_ResizeMode { - /** - * In this mode, the context does not change size or offset. If the backing - * store is the same size as the plugin element, this will result in the - * pixels on the right side of the plugin element being unavailable, revealing - * the contents underneath it. - */ - PP_GRAPHICS2D_DEV_RESIZEMODE_DEFAULT, - /** - * In this mode, the context and its offset are scaled relative to how much - * the plugin element has been resized. - */ - PP_GRAPHICS2D_DEV_RESIZEMODE_STRETCH -}; - -/* PPB_Graphics2D_Dev interface */ -interface PPB_Graphics2D_Dev { - /** - * SetScale() sets the scale factor that will be applied when painting the - * graphics context onto the output device. Typically, if rendering at device - * resolution is desired, the context would be created with the width and - * height scaled up by the view's GetDeviceScale and SetScale called with a - * scale of 1.0 / GetDeviceScale(). For example, if the view resource passed - * to DidChangeView has a rectangle of (w=200, h=100) and a device scale of - * 2.0, one would call Create with a size of (w=400, h=200) and then call - * SetScale with 0.5. One would then treat each pixel in the context as a - * single device pixel. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * @param[in] scale The scale to apply when painting. - * - * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if - * the resource is invalid or the scale factor is 0 or less. - */ - PP_Bool SetScale( - [in] PP_Resource resource, - [in] float_t scale); - - /*** - * GetScale() gets the scale factor that will be applied when painting the - * graphics context onto the output device. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * - * @return Returns the scale factor for the graphics context. If the resource - * is not a valid <code>Graphics2D</code> context, this will return 0.0. - */ - float_t GetScale( - [in] PP_Resource resource); - - /*** - * Sets the offset into the plugin element at which the graphics context is - * painted. This allows a portion of the plugin element to be painted to. - * The new offset will only be applied after Flush() has been called. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * @param[in] offset The offset at which the context should be painted. - */ - [version=0.2] - void SetOffset( - [in] PP_Resource resource, - [in] PP_Point offset); - - /*** - * Sets the resize mode for the graphics context. When a plugin element is - * resized in the DOM, it takes time for the plugin to update the graphics - * context in the renderer. These options affect how the existing context is - * displayed until the backing store is updated by the plugin. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * @param[in] resize_mode The resize mode to change this context to. - */ - void SetResizeMode( - [in] PP_Resource resource, - [in] PP_Graphics2D_Dev_ResizeMode resize_mode); -}; - diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl index 9e321f6e2d..f3416a8ffa 100644 --- a/ppapi/api/private/ppb_nacl_private.idl +++ b/ppapi/api/private/ppb_nacl_private.idl @@ -283,12 +283,25 @@ interface PPB_NaCl_Private { [in] PP_Var key, [in] PP_Var value); + /* Report that the nexe loaded successfully. */ + void ReportLoadSuccess([in] PP_Instance instance, + [in] str_t url, + [in] uint64_t loaded_bytes, + [in] uint64_t total_bytes); + /* Report an error that occured while attempting to load a nexe. */ void ReportLoadError([in] PP_Instance instance, [in] PP_NaClError error, [in] str_t error_message, [in] str_t console_message); + /* Reports that loading a nexe was aborted. */ + void ReportLoadAbort([in] PP_Instance instance); + + /* Reports that the nexe has crashed or is otherwise dead. */ + void ReportDeadNexe([in] PP_Instance instance, + [in] int64_t crash_time); + /* Performs internal setup when an instance is created. */ void InstanceCreated([in] PP_Instance instance); @@ -315,10 +328,6 @@ interface PPB_NaCl_Private { /* Returns PP_TRUE if an error has been reported loading the nexe. */ PP_Bool GetNexeErrorReported([in] PP_Instance instance); - /* Sets the nexe error reported state for this instance. */ - void SetNexeErrorReported([in] PP_Instance instance, - [in] PP_Bool error_reported); - /* Returns the NaCl readiness status for this instance. */ PP_NaClReadyState GetNaClReadyState([in] PP_Instance instance); @@ -332,4 +341,11 @@ interface PPB_NaCl_Private { /* Sets whether the plugin is an installed app. */ void SetIsInstalled([in] PP_Instance instance, [in] PP_Bool is_installed); + + /* Returns the time the nexe became ready. */ + int64_t GetReadyTime([in] PP_Instance instance); + + /* Sets the time the nexe became ready. */ + void SetReadyTime([in] PP_Instance instance, + [in] int64_t ready_time); }; diff --git a/ppapi/c/dev/ppb_graphics_2d_dev.h b/ppapi/c/dev/ppb_graphics_2d_dev.h deleted file mode 100644 index 245ae588ff..0000000000 --- a/ppapi/c/dev/ppb_graphics_2d_dev.h +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright (c) 2012 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 dev/ppb_graphics_2d_dev.idl modified Tue Nov 12 11:22:26 2013. */ - -#ifndef PPAPI_C_DEV_PPB_GRAPHICS_2D_DEV_H_ -#define PPAPI_C_DEV_PPB_GRAPHICS_2D_DEV_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_point.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" - -#define PPB_GRAPHICS2D_DEV_INTERFACE_0_1 "PPB_Graphics2D(Dev);0.1" -#define PPB_GRAPHICS2D_DEV_INTERFACE_0_2 "PPB_Graphics2D(Dev);0.2" -#define PPB_GRAPHICS2D_DEV_INTERFACE PPB_GRAPHICS2D_DEV_INTERFACE_0_2 - -/** - * @file - * This file contains the <code>PPB_Graphics2D_Dev</code> interface. */ - - -/** - * @addtogroup Enums - * @{ - */ -/** - * These options affect how the existing graphics context is displayed when a - * plugin is resized. - */ -typedef enum { - /** - * In this mode, the context does not change size or offset. If the backing - * store is the same size as the plugin element, this will result in the - * pixels on the right side of the plugin element being unavailable, revealing - * the contents underneath it. - */ - PP_GRAPHICS2D_DEV_RESIZEMODE_DEFAULT, - /** - * In this mode, the context and its offset are scaled relative to how much - * the plugin element has been resized. - */ - PP_GRAPHICS2D_DEV_RESIZEMODE_STRETCH -} PP_Graphics2D_Dev_ResizeMode; -PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Graphics2D_Dev_ResizeMode, 4); -/** - * @} - */ - -/** - * @addtogroup Interfaces - * @{ - */ -/* PPB_Graphics2D_Dev interface */ -struct PPB_Graphics2D_Dev_0_2 { - /** - * SetScale() sets the scale factor that will be applied when painting the - * graphics context onto the output device. Typically, if rendering at device - * resolution is desired, the context would be created with the width and - * height scaled up by the view's GetDeviceScale and SetScale called with a - * scale of 1.0 / GetDeviceScale(). For example, if the view resource passed - * to DidChangeView has a rectangle of (w=200, h=100) and a device scale of - * 2.0, one would call Create with a size of (w=400, h=200) and then call - * SetScale with 0.5. One would then treat each pixel in the context as a - * single device pixel. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * @param[in] scale The scale to apply when painting. - * - * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if - * the resource is invalid or the scale factor is 0 or less. - */ - PP_Bool (*SetScale)(PP_Resource resource, float scale); - /*** - * GetScale() gets the scale factor that will be applied when painting the - * graphics context onto the output device. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * - * @return Returns the scale factor for the graphics context. If the resource - * is not a valid <code>Graphics2D</code> context, this will return 0.0. - */ - float (*GetScale)(PP_Resource resource); - /*** - * Sets the offset into the plugin element at which the graphics context is - * painted. This allows a portion of the plugin element to be painted to. - * The new offset will only be applied after Flush() has been called. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * @param[in] offset The offset at which the context should be painted. - */ - void (*SetOffset)(PP_Resource resource, const struct PP_Point* offset); - /*** - * Sets the resize mode for the graphics context. When a plugin element is - * resized in the DOM, it takes time for the plugin to update the graphics - * context in the renderer. These options affect how the existing context is - * displayed until the backing store is updated by the plugin. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * @param[in] resize_mode The resize mode to change this context to. - */ - void (*SetResizeMode)(PP_Resource resource, - PP_Graphics2D_Dev_ResizeMode resize_mode); -}; - -typedef struct PPB_Graphics2D_Dev_0_2 PPB_Graphics2D_Dev; - -struct PPB_Graphics2D_Dev_0_1 { - PP_Bool (*SetScale)(PP_Resource resource, float scale); - float (*GetScale)(PP_Resource resource); - void (*SetResizeMode)(PP_Resource resource, - PP_Graphics2D_Dev_ResizeMode resize_mode); -}; -/** - * @} - */ - -#endif /* PPAPI_C_DEV_PPB_GRAPHICS_2D_DEV_H_ */ - diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h index c389c841f1..709f9587a8 100644 --- a/ppapi/c/private/ppb_nacl_private.h +++ b/ppapi/c/private/ppb_nacl_private.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From private/ppb_nacl_private.idl modified Thu Mar 27 14:44:04 2014. */ +/* From private/ppb_nacl_private.idl modified Mon Mar 31 13:29:26 2014. */ #ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ #define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ @@ -290,11 +290,20 @@ struct PPB_NaCl_Private_1_0 { void (*SetReadOnlyProperty)(PP_Instance instance, struct PP_Var key, struct PP_Var value); + /* Report that the nexe loaded successfully. */ + void (*ReportLoadSuccess)(PP_Instance instance, + const char* url, + uint64_t loaded_bytes, + uint64_t total_bytes); /* Report an error that occured while attempting to load a nexe. */ void (*ReportLoadError)(PP_Instance instance, PP_NaClError error, const char* error_message, const char* console_message); + /* Reports that loading a nexe was aborted. */ + void (*ReportLoadAbort)(PP_Instance instance); + /* Reports that the nexe has crashed or is otherwise dead. */ + void (*ReportDeadNexe)(PP_Instance instance, int64_t crash_time); /* Performs internal setup when an instance is created. */ void (*InstanceCreated)(PP_Instance instance); /* Performs internal cleanup when an instance is destroyed. */ @@ -313,8 +322,6 @@ struct PPB_NaCl_Private_1_0 { void (*LogToConsole)(PP_Instance instance, const char* message); /* Returns PP_TRUE if an error has been reported loading the nexe. */ PP_Bool (*GetNexeErrorReported)(PP_Instance instance); - /* Sets the nexe error reported state for this instance. */ - void (*SetNexeErrorReported)(PP_Instance instance, PP_Bool error_reported); /* Returns the NaCl readiness status for this instance. */ PP_NaClReadyState (*GetNaClReadyState)(PP_Instance instance); /* Sets the NaCl readiness status for this instance. */ @@ -324,6 +331,10 @@ struct PPB_NaCl_Private_1_0 { PP_Bool (*GetIsInstalled)(PP_Instance instance); /* Sets whether the plugin is an installed app. */ void (*SetIsInstalled)(PP_Instance instance, PP_Bool is_installed); + /* Returns the time the nexe became ready. */ + int64_t (*GetReadyTime)(PP_Instance instance); + /* Sets the time the nexe became ready. */ + void (*SetReadyTime)(PP_Instance instance, int64_t ready_time); }; typedef struct PPB_NaCl_Private_1_0 PPB_NaCl_Private; diff --git a/ppapi/cpp/dev/graphics_2d_dev.cc b/ppapi/cpp/dev/graphics_2d_dev.cc deleted file mode 100644 index 3fd000cc2d..0000000000 --- a/ppapi/cpp/dev/graphics_2d_dev.cc +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2012 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/dev/graphics_2d_dev.h" - -#include "ppapi/cpp/module_impl.h" -#include "ppapi/cpp/point.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_Graphics2D_Dev_0_1>() { - return PPB_GRAPHICS2D_DEV_INTERFACE_0_1; -} - -template <> const char* interface_name<PPB_Graphics2D_Dev_0_2>() { - return PPB_GRAPHICS2D_DEV_INTERFACE_0_2; -} - -} // namespace - -// static -bool Graphics2D_Dev::SupportsScale() { - return has_interface<PPB_Graphics2D_Dev_0_1>() || - has_interface<PPB_Graphics2D_Dev_0_2>(); -} - -bool Graphics2D_Dev::SetScale(float scale) { - if (has_interface<PPB_Graphics2D_Dev_0_2>()) { - return PP_ToBool(get_interface<PPB_Graphics2D_Dev_0_2>()->SetScale( - pp_resource(), scale)); - } - if (has_interface<PPB_Graphics2D_Dev_0_1>()) { - return PP_ToBool(get_interface<PPB_Graphics2D_Dev_0_1>()->SetScale( - pp_resource(), scale)); - } - return false; -} - -float Graphics2D_Dev::GetScale() { - if (has_interface<PPB_Graphics2D_Dev_0_2>()) - return get_interface<PPB_Graphics2D_Dev_0_2>()->GetScale(pp_resource()); - if (has_interface<PPB_Graphics2D_Dev_0_1>()) - return get_interface<PPB_Graphics2D_Dev_0_1>()->GetScale(pp_resource()); - return 1.0f; -} - -void Graphics2D_Dev::SetOffset(const pp::Point& offset) { - if (!has_interface<PPB_Graphics2D_Dev_0_2>()) - return; - get_interface<PPB_Graphics2D_Dev_0_2>()->SetOffset(pp_resource(), - &offset.pp_point()); -} - -void Graphics2D_Dev::SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode) { - if (!has_interface<PPB_Graphics2D_Dev_0_2>()) - return; - get_interface<PPB_Graphics2D_Dev_0_2>()->SetResizeMode(pp_resource(), - resize_mode); -} - -} // namespace pp diff --git a/ppapi/cpp/dev/graphics_2d_dev.h b/ppapi/cpp/dev/graphics_2d_dev.h deleted file mode 100644 index 52c2e666d9..0000000000 --- a/ppapi/cpp/dev/graphics_2d_dev.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2012 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_DEV_GRAPHICS_2D_DEV_H_ -#define PPAPI_CPP_DEV_GRAPHICS_2D_DEV_H_ - -#include "ppapi/cpp/graphics_2d.h" - -#include "ppapi/c/dev/ppb_graphics_2d_dev.h" - -namespace pp { - -class Point; - -// Graphics2DDev is a version of Graphics2D that exposes under-development APIs -// for HiDPI -class Graphics2D_Dev : public Graphics2D { - public: - /// Default constructor for creating an is_null() - /// <code>Graphics2D_Dev</code> object. - Graphics2D_Dev() : Graphics2D() {} - - // Constructor for creating a <code>Graphics2DDev</code> object from an - // existing <code>Graphics2D</code> object. - Graphics2D_Dev(const Graphics2D& other) : Graphics2D(other) {} - - virtual ~Graphics2D_Dev() {} - - /// Returns true if SetScale and GetScale are supported. False if not. - static bool SupportsScale(); - - /// SetScale() sets the scale factor that will be applied when painting the - /// graphics context onto the output device. Typically, if rendering at device - /// resolution is desired, the context would be created with the width and - /// height scaled up by the view's GetDeviceScale and SetScale called with a - /// scale of 1.0 / GetDeviceScale(). For example, if the view resource passed - /// to DidChangeView has a rectangle of (w=200, h=100) and a device scale of - /// 2.0, one would call Create with a size of (w=400, h=200) and then call - /// SetScale with 0.5. One would then treat each pixel in the context as a - /// single device pixel. - /// - /// @param[in] scale The scale to apply when painting. - /// - /// @return Returns <code>true</code> on success or <code>false</code> - /// if the resource is invalid or the scale factor is 0 or less. - bool SetScale(float scale); - - /// GetScale() gets the scale factor that will be applied when painting the - /// graphics context onto the output device. - /// - /// @return Returns the scale factor for the graphics context. If the resource - /// is invalid, 0.0 will be returned. - float GetScale(); - - /// Set the offset into the plugin element at which the graphics context is - /// painted. This allows a portion of the plugin element to be painted to. - /// The new offset will only be applied after Flush() has been called. - /// - /// @param[in] resource A <code>Graphics2D</code> context resource. - /// @param[in] offset The offset at which the context should be painted. - void SetOffset(const pp::Point& offset); - - /// Sets the resize mode for the graphics context. When a plugin element is - /// resized in the DOM, it takes time for the plugin to update the graphics - /// context in the renderer. These options affect how the existing context is - /// displayed until the backing store is updated by the plugin. - /// - ///@param[in] resource A <code>Graphics2D</code> context resource. - ///@param[in] resize_mode The resize mode to change this context to. - void SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode); -}; - -} // namespace pp - -#endif // PPAPI_CPP_DEV_GRAPHICS_2D_DEV_H_ diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index e98c4c8990..1b735f58a2 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -230,18 +230,6 @@ void Plugin::HistogramEnumerateOsArch(const std::string& sandbox_isa) { HistogramEnumerate("NaCl.Client.OSArch", os_arch, kNaClOSArchMax, -1); } -void Plugin::HistogramEnumerateLoadStatus(PP_NaClError error_code) { - HistogramEnumerate("NaCl.LoadStatus.Plugin", error_code, PP_NACL_ERROR_MAX, - PP_NACL_ERROR_UNKNOWN); - - // Gather data to see if being installed changes load outcomes. - const char* name = nacl_interface_->GetIsInstalled(pp_instance()) ? - "NaCl.LoadStatus.Plugin.InstalledApp" : - "NaCl.LoadStatus.Plugin.NotInstalledApp"; - HistogramEnumerate(name, error_code, PP_NACL_ERROR_MAX, - PP_NACL_ERROR_UNKNOWN); -} - void Plugin::HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code) { HistogramEnumerate("NaCl.LoadStatus.SelLdr", error_code, NACL_ERROR_CODE_MAX, LOAD_STATUS_UNKNOWN); @@ -592,7 +580,6 @@ Plugin::Plugin(PP_Instance pp_instance) wrapper_factory_(NULL), enable_dev_interfaces_(false), init_time_(0), - ready_time_(0), nexe_size_(0), time_of_last_progress_event_(0), exit_status_(-1), @@ -608,7 +595,6 @@ Plugin::Plugin(PP_Instance pp_instance) // Notify PPB_NaCl_Private that the instance is created before altering any // state that it tracks. nacl_interface_->InstanceCreated(pp_instance); - set_last_error_string(""); // We call set_exit_status() here to ensure that the 'exitStatus' property is // set. This can only be called when nacl_interface_ is not NULL. set_exit_status(-1); @@ -623,10 +609,11 @@ Plugin::~Plugin() { // Destroy the coordinator while the rest of the data is still there pnacl_coordinator_.reset(NULL); + int64_t ready_time = nacl_interface_->GetReadyTime(pp_instance()); if (!nacl_interface_->GetNexeErrorReported(pp_instance())) { HistogramTimeLarge( "NaCl.ModuleUptime.Normal", - (shutdown_start - ready_time_) / NACL_MICROS_PER_MILLI); + (shutdown_start - ready_time) / NACL_MICROS_PER_MILLI); } for (std::map<nacl::string, NaClFileInfoAutoCloser*>::iterator it = @@ -728,16 +715,8 @@ void Plugin::NexeFileDidOpen(int32_t pp_error) { } return; } - int32_t file_desc_ok_to_close = DUP(info.get_desc()); - if (file_desc_ok_to_close == NACL_NO_FILE_DESC) { - error_info.SetReport(PP_NACL_ERROR_NEXE_FH_DUP, - "could not duplicate loaded file handle."); - ReportLoadError(error_info); - return; - } struct stat stat_buf; - if (0 != fstat(file_desc_ok_to_close, &stat_buf)) { - CLOSE(file_desc_ok_to_close); + if (0 != fstat(info.get_desc(), &stat_buf)) { error_info.SetReport(PP_NACL_ERROR_NEXE_STAT, "could not stat nexe file."); ReportLoadError(error_info); return; @@ -760,7 +739,7 @@ void Plugin::NexeFileDidOpen(int32_t pp_error) { load_start_ = NaClGetTimeOfDayMicroseconds(); nacl::scoped_ptr<nacl::DescWrapper> - wrapper(wrapper_factory()->MakeFileDesc(file_desc_ok_to_close, O_RDONLY)); + wrapper(wrapper_factory()->MakeFileDesc(info.Release().desc, O_RDONLY)); NaClLog(4, "NexeFileDidOpen: invoking LoadNaClModule\n"); LoadNaClModule( wrapper.release(), @@ -784,15 +763,16 @@ void Plugin::NexeFileDidOpenContinuation(int32_t pp_error) { if (was_successful) { NaClLog(4, "NexeFileDidOpenContinuation: success;" " setting histograms\n"); - ready_time_ = NaClGetTimeOfDayMicroseconds(); + int64_t ready_time = NaClGetTimeOfDayMicroseconds(); + nacl_interface_->SetReadyTime(pp_instance(), ready_time); HistogramStartupTimeSmall( "NaCl.Perf.StartupTime.LoadModule", - static_cast<float>(ready_time_ - load_start_) / NACL_MICROS_PER_MILLI); + static_cast<float>(ready_time - load_start_) / NACL_MICROS_PER_MILLI); HistogramStartupTimeMedium( "NaCl.Perf.StartupTime.Total", - static_cast<float>(ready_time_ - init_time_) / NACL_MICROS_PER_MILLI); + static_cast<float>(ready_time - init_time_) / NACL_MICROS_PER_MILLI); - ReportLoadSuccess(LENGTH_IS_COMPUTABLE, nexe_size_, nexe_size_); + ReportLoadSuccess(nexe_size_, nexe_size_); } else { NaClLog(4, "NexeFileDidOpenContinuation: failed."); ReportLoadError(error_info); @@ -902,35 +882,15 @@ void Plugin::BitcodeDidTranslateContinuation(int32_t pp_error) { int64_t loaded; int64_t total; pnacl_coordinator_->GetCurrentProgress(&loaded, &total); - ReportLoadSuccess(LENGTH_IS_COMPUTABLE, loaded, total); + ReportLoadSuccess(loaded, total); } else { ReportLoadError(error_info); } } void Plugin::ReportDeadNexe() { - PLUGIN_PRINTF(("Plugin::ReportDeadNexe\n")); - - PP_NaClReadyState ready_state = - nacl_interface_->GetNaClReadyState(pp_instance()); - if (ready_state == PP_NACL_READY_STATE_DONE && // After loadEnd - !nacl_interface_->GetNexeErrorReported(pp_instance())) { - int64_t crash_time = NaClGetTimeOfDayMicroseconds(); - // Crashes will be more likely near startup, so use a medium histogram - // instead of a large one. - HistogramTimeMedium( - "NaCl.ModuleUptime.Crash", - (crash_time - ready_time_) / NACL_MICROS_PER_MILLI); - - nacl::string message = nacl::string("NaCl module crashed"); - set_last_error_string(message); - nacl_interface()->LogToConsole(pp_instance(), message.c_str()); - - EnqueueProgressEvent(PP_NACL_EVENT_CRASH); - nacl_interface_->SetNexeErrorReported(pp_instance(), PP_TRUE); - } - // else ReportLoadError() and ReportAbortError() will be used by loading code - // to provide error handling. + nacl_interface_->ReportDeadNexe( + pp_instance(), NaClGetTimeOfDayMicroseconds()); } void Plugin::NaClManifestBufferReady(int32_t pp_error) { @@ -1254,26 +1214,14 @@ bool Plugin::StreamAsFile(const nacl::string& url, } -void Plugin::ReportLoadSuccess(LengthComputable length_computable, - uint64_t loaded_bytes, - uint64_t total_bytes) { - // Set the readyState attribute to indicate loaded. - nacl_interface_->SetNaClReadyState(pp_instance(), PP_NACL_READY_STATE_DONE); - // Inform JavaScript that loading was successful and is complete. +void Plugin::ReportLoadSuccess(uint64_t loaded_bytes, uint64_t total_bytes) { const nacl::string& url = nexe_downloader_.url(); - EnqueueProgressEvent( - PP_NACL_EVENT_LOAD, url, length_computable, loaded_bytes, total_bytes); - EnqueueProgressEvent( - PP_NACL_EVENT_LOADEND, url, length_computable, loaded_bytes, total_bytes); - - // UMA - HistogramEnumerateLoadStatus(PP_NACL_ERROR_LOAD_SUCCESS); + nacl_interface_->ReportLoadSuccess( + pp_instance(), url.c_str(), loaded_bytes, total_bytes); } void Plugin::ReportLoadError(const ErrorInfo& error_info) { - PLUGIN_PRINTF(("Plugin::ReportLoadError (error='%s')\n", - error_info.message().c_str())); nacl_interface_->ReportLoadError(pp_instance(), error_info.error_code(), error_info.message().c_str(), @@ -1282,20 +1230,7 @@ void Plugin::ReportLoadError(const ErrorInfo& error_info) { void Plugin::ReportLoadAbort() { - PLUGIN_PRINTF(("Plugin::ReportLoadAbort\n")); - // Set the readyState attribute to indicate we need to start over. - nacl_interface()->SetNaClReadyState(pp_instance(), PP_NACL_READY_STATE_DONE); - nacl_interface()->SetNexeErrorReported(pp_instance(), PP_TRUE); - // Report an error in lastError and on the JavaScript console. - nacl::string error_string("NaCl module load failed: user aborted"); - set_last_error_string(error_string); - nacl_interface()->LogToConsole(pp_instance(), error_string.c_str()); - // Inform JavaScript that loading was aborted and is complete. - EnqueueProgressEvent(PP_NACL_EVENT_ABORT); - EnqueueProgressEvent(PP_NACL_EVENT_LOADEND); - - // UMA - HistogramEnumerateLoadStatus(PP_NACL_ERROR_LOAD_ABORTED); + nacl_interface_->ReportLoadAbort(pp_instance()); } void Plugin::UpdateDownloadProgress( @@ -1421,13 +1356,6 @@ bool Plugin::DocumentCanRequest(const std::string& url) { return url_util_->DocumentCanRequest(this, pp::Var(url)); } -void Plugin::set_last_error_string(const nacl::string& error) { - DCHECK(nacl_interface_); - nacl_interface_->SetReadOnlyProperty(pp_instance(), - pp::Var("lastError").pp_var(), - pp::Var(error).pp_var()); -} - void Plugin::set_exit_status(int exit_status) { pp::Core* core = pp::Module::Get()->core(); if (core->IsMainThread()) { diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h index d7a5962283..f3831d6073 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.h +++ b/ppapi/native_client/src/trusted/plugin/plugin.h @@ -123,9 +123,7 @@ class Plugin : public pp::Instance { LENGTH_IS_COMPUTABLE = 1 }; // Report successful loading of a module. - void ReportLoadSuccess(LengthComputable length_computable, - uint64_t loaded_bytes, - uint64_t total_bytes); + void ReportLoadSuccess(uint64_t loaded_bytes, uint64_t total_bytes); // Report an error that was encountered while loading a module. void ReportLoadError(const ErrorInfo& error_info); // Report loading a module was aborted, typically due to user action. @@ -191,8 +189,6 @@ class Plugin : public pp::Instance { // document to request the URL using CORS even if this function returns false. bool DocumentCanRequest(const std::string& url); - void set_last_error_string(const nacl::string& error); - // The MIME type used to instantiate this instance of the NaCl plugin. // Typically, the MIME type will be application/x-nacl. However, if the NEXE // is being used as a content type handler for another content type (such as @@ -414,7 +410,6 @@ class Plugin : public pp::Instance { int64_t load_start_; int64_t init_time_; - int64_t ready_time_; size_t nexe_size_; // Callback to receive .nexe and .dso download progress notifications. diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index ce83fba85c..433cd009ae 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -3161,11 +3161,26 @@ static void Pnacl_M25_PPB_NaCl_Private_SetReadOnlyProperty(PP_Instance instance, iface->SetReadOnlyProperty(instance, *key, *value); } +static void Pnacl_M25_PPB_NaCl_Private_ReportLoadSuccess(PP_Instance instance, const char* url, uint64_t loaded_bytes, uint64_t total_bytes) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + iface->ReportLoadSuccess(instance, url, loaded_bytes, total_bytes); +} + static void Pnacl_M25_PPB_NaCl_Private_ReportLoadError(PP_Instance instance, PP_NaClError error, const char* error_message, const char* console_message) { const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; iface->ReportLoadError(instance, error, error_message, console_message); } +static void Pnacl_M25_PPB_NaCl_Private_ReportLoadAbort(PP_Instance instance) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + iface->ReportLoadAbort(instance); +} + +static void Pnacl_M25_PPB_NaCl_Private_ReportDeadNexe(PP_Instance instance, int64_t crash_time) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + iface->ReportDeadNexe(instance, crash_time); +} + static void Pnacl_M25_PPB_NaCl_Private_InstanceCreated(PP_Instance instance) { const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; iface->InstanceCreated(instance); @@ -3201,11 +3216,6 @@ static PP_Bool Pnacl_M25_PPB_NaCl_Private_GetNexeErrorReported(PP_Instance insta return iface->GetNexeErrorReported(instance); } -static void Pnacl_M25_PPB_NaCl_Private_SetNexeErrorReported(PP_Instance instance, PP_Bool error_reported) { - const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; - iface->SetNexeErrorReported(instance, error_reported); -} - static PP_NaClReadyState Pnacl_M25_PPB_NaCl_Private_GetNaClReadyState(PP_Instance instance) { const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; return iface->GetNaClReadyState(instance); @@ -3226,6 +3236,16 @@ static void Pnacl_M25_PPB_NaCl_Private_SetIsInstalled(PP_Instance instance, PP_B iface->SetIsInstalled(instance, is_installed); } +static int64_t Pnacl_M25_PPB_NaCl_Private_GetReadyTime(PP_Instance instance) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + return iface->GetReadyTime(instance); +} + +static void Pnacl_M25_PPB_NaCl_Private_SetReadyTime(PP_Instance instance, int64_t ready_time) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + iface->SetReadyTime(instance, ready_time); +} + /* End wrapper methods for PPB_NaCl_Private_1_0 */ /* Begin wrapper methods for PPB_NetAddress_Private_0_1 */ @@ -5118,7 +5138,10 @@ static const struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = { .OpenNaClExecutable = (PP_FileHandle (*)(PP_Instance instance, const char* file_url, uint64_t* file_token_lo, uint64_t* file_token_hi))&Pnacl_M25_PPB_NaCl_Private_OpenNaClExecutable, .DispatchEvent = (void (*)(PP_Instance instance, PP_NaClEventType event_type, const char* resource_url, PP_Bool length_is_computable, uint64_t loaded_bytes, uint64_t total_bytes))&Pnacl_M25_PPB_NaCl_Private_DispatchEvent, .SetReadOnlyProperty = (void (*)(PP_Instance instance, struct PP_Var key, struct PP_Var value))&Pnacl_M25_PPB_NaCl_Private_SetReadOnlyProperty, + .ReportLoadSuccess = (void (*)(PP_Instance instance, const char* url, uint64_t loaded_bytes, uint64_t total_bytes))&Pnacl_M25_PPB_NaCl_Private_ReportLoadSuccess, .ReportLoadError = (void (*)(PP_Instance instance, PP_NaClError error, const char* error_message, const char* console_message))&Pnacl_M25_PPB_NaCl_Private_ReportLoadError, + .ReportLoadAbort = (void (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_ReportLoadAbort, + .ReportDeadNexe = (void (*)(PP_Instance instance, int64_t crash_time))&Pnacl_M25_PPB_NaCl_Private_ReportDeadNexe, .InstanceCreated = (void (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_InstanceCreated, .InstanceDestroyed = (void (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_InstanceDestroyed, .NaClDebugEnabledForURL = (PP_Bool (*)(const char* alleged_nmf_url))&Pnacl_M25_PPB_NaCl_Private_NaClDebugEnabledForURL, @@ -5126,11 +5149,12 @@ static const struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = { .GetUrlScheme = (PP_UrlSchemeType (*)(struct PP_Var url))&Pnacl_M25_PPB_NaCl_Private_GetUrlScheme, .LogToConsole = (void (*)(PP_Instance instance, const char* message))&Pnacl_M25_PPB_NaCl_Private_LogToConsole, .GetNexeErrorReported = (PP_Bool (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_GetNexeErrorReported, - .SetNexeErrorReported = (void (*)(PP_Instance instance, PP_Bool error_reported))&Pnacl_M25_PPB_NaCl_Private_SetNexeErrorReported, .GetNaClReadyState = (PP_NaClReadyState (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_GetNaClReadyState, .SetNaClReadyState = (void (*)(PP_Instance instance, PP_NaClReadyState ready_state))&Pnacl_M25_PPB_NaCl_Private_SetNaClReadyState, .GetIsInstalled = (PP_Bool (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_GetIsInstalled, - .SetIsInstalled = (void (*)(PP_Instance instance, PP_Bool is_installed))&Pnacl_M25_PPB_NaCl_Private_SetIsInstalled + .SetIsInstalled = (void (*)(PP_Instance instance, PP_Bool is_installed))&Pnacl_M25_PPB_NaCl_Private_SetIsInstalled, + .GetReadyTime = (int64_t (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_GetReadyTime, + .SetReadyTime = (void (*)(PP_Instance instance, int64_t ready_time))&Pnacl_M25_PPB_NaCl_Private_SetReadyTime }; static const struct PPB_NetAddress_Private_0_1 Pnacl_Wrappers_PPB_NetAddress_Private_0_1 = { diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi index 1a96e12147..03ad1ccc1d 100644 --- a/ppapi/ppapi_shared.gypi +++ b/ppapi/ppapi_shared.gypi @@ -195,7 +195,6 @@ 'thunk/ppb_gamepad_thunk.cc', 'thunk/ppb_gles_chromium_texture_mapping_thunk.cc', 'thunk/ppb_graphics_2d_api.h', - 'thunk/ppb_graphics_2d_dev_thunk.cc', 'thunk/ppb_graphics_2d_thunk.cc', 'thunk/ppb_graphics_3d_api.h', 'thunk/ppb_graphics_3d_thunk.cc', diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi index 600f36b29e..bc8865449c 100644 --- a/ppapi/ppapi_sources.gypi +++ b/ppapi/ppapi_sources.gypi @@ -264,8 +264,6 @@ 'cpp/dev/file_chooser_dev.h', 'cpp/dev/font_dev.cc', 'cpp/dev/font_dev.h', - 'cpp/dev/graphics_2d_dev.cc', - 'cpp/dev/graphics_2d_dev.h', 'cpp/dev/ime_input_event_dev.cc', 'cpp/dev/ime_input_event_dev.h', 'cpp/dev/may_own_ptr_dev.h', diff --git a/ppapi/proxy/graphics_2d_resource.cc b/ppapi/proxy/graphics_2d_resource.cc index f545364f1e..0cf7465700 100644 --- a/ppapi/proxy/graphics_2d_resource.cc +++ b/ppapi/proxy/graphics_2d_resource.cc @@ -103,7 +103,7 @@ void Graphics2DResource::ReplaceContents(PP_Resource image_data) { PP_Bool Graphics2DResource::SetScale(float scale) { if (scale <= 0.0f) return PP_FALSE; - Post(RENDERER, PpapiHostMsg_Graphics2D_Dev_SetScale(scale)); + Post(RENDERER, PpapiHostMsg_Graphics2D_SetScale(scale)); scale_ = scale; return PP_TRUE; } @@ -112,15 +112,6 @@ float Graphics2DResource::GetScale() { return scale_; } -void Graphics2DResource::SetOffset(const PP_Point* offset) { - Post(RENDERER, PpapiHostMsg_Graphics2D_SetOffset(*offset)); -} - -void Graphics2DResource::SetResizeMode( - PP_Graphics2D_Dev_ResizeMode resize_mode) { - Post(RENDERER, PpapiHostMsg_Graphics2D_SetResizeMode(resize_mode)); -} - int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) { // If host is not even created, return failure immediately. This can happen // when failed to initialize (in constructor). @@ -131,20 +122,9 @@ int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) { return PP_ERROR_INPROGRESS; // Can't have >1 flush pending. current_flush_callback_ = callback; - // Send the current view data with the Flush() message. This allows the - // renderer to know what the plugin's view of the renderer is at the time - // Flush was called. - PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance( - pp_instance()); - ppapi::ViewData view_data; - if (dispatcher) { - InstanceData* data = dispatcher->GetInstanceData(pp_instance()); - if (data) - view_data = data->view; - } Call<PpapiPluginMsg_Graphics2D_FlushAck>( RENDERER, - PpapiHostMsg_Graphics2D_Flush(view_data), + PpapiHostMsg_Graphics2D_Flush(), base::Bind(&Graphics2DResource::OnPluginMsgFlushACK, this)); return PP_OK_COMPLETIONPENDING; } diff --git a/ppapi/proxy/graphics_2d_resource.h b/ppapi/proxy/graphics_2d_resource.h index 93d182b65a..b7ec30c710 100644 --- a/ppapi/proxy/graphics_2d_resource.h +++ b/ppapi/proxy/graphics_2d_resource.h @@ -40,8 +40,6 @@ class PPAPI_PROXY_EXPORT Graphics2DResource virtual void ReplaceContents(PP_Resource image_data) OVERRIDE; virtual PP_Bool SetScale(float scale) OVERRIDE; virtual float GetScale() OVERRIDE; - virtual void SetOffset(const PP_Point* offset) OVERRIDE; - virtual void SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode) OVERRIDE; virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) OVERRIDE; virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) OVERRIDE; diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index a5f58d38bb..dd350c4d54 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -16,7 +16,6 @@ #include "ppapi/c/dev/ppb_device_ref_dev.h" #include "ppapi/c/dev/ppb_font_dev.h" #include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h" -#include "ppapi/c/dev/ppb_graphics_2d_dev.h" #include "ppapi/c/dev/ppb_ime_input_event_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" #include "ppapi/c/dev/ppb_opengles2ext_dev.h" diff --git a/ppapi/proxy/nacl_message_scanner.cc b/ppapi/proxy/nacl_message_scanner.cc index 6fb98f5f1c..1cbf53dd84 100644 --- a/ppapi/proxy/nacl_message_scanner.cc +++ b/ppapi/proxy/nacl_message_scanner.cc @@ -327,7 +327,7 @@ bool NaClMessageScanner::ScanMessage( uint32_t type = iter->second; pending_sync_msgs_.erase(iter); switch (type) { - CASE_FOR_REPLY(PpapiHostMsg_PPBGraphics3D_GetTransferBuffer) + CASE_FOR_REPLY(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer) CASE_FOR_REPLY(PpapiHostMsg_PPBImageData_CreateSimple) CASE_FOR_REPLY(PpapiHostMsg_ResourceSyncCall) CASE_FOR_REPLY(PpapiHostMsg_SharedMemory_CreateSharedMemory) diff --git a/ppapi/proxy/nacl_message_scanner_unittest.cc b/ppapi/proxy/nacl_message_scanner_unittest.cc index 8e81e247f5..3e439559c7 100644 --- a/ppapi/proxy/nacl_message_scanner_unittest.cc +++ b/ppapi/proxy/nacl_message_scanner_unittest.cc @@ -69,11 +69,13 @@ TEST_F(NaClMessageScannerTest, SyncMessageAndReply) { NaClMessageScanner test; ppapi::proxy::SerializedHandle handle( ppapi::proxy::SerializedHandle::SHARED_MEMORY); + int id = -1; IPC::Message msg = - PpapiHostMsg_PPBGraphics3D_GetTransferBuffer( + PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer( ppapi::API_ID_PPB_GRAPHICS_3D, HostResource(), - 0, // id + 4096, // size + &id, &handle); scoped_ptr<IPC::Message> new_msg_ptr; EXPECT_NE(msg.type(), FindPendingSyncMessage(test, msg)); diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc index 4d140f2a8e..1e4820d5ec 100644 --- a/ppapi/proxy/ppapi_command_buffer_proxy.cc +++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc @@ -106,11 +106,6 @@ void PpapiCommandBufferProxy::SetGetBuffer(int32 transfer_buffer_id) { } } -void PpapiCommandBufferProxy::SetGetOffset(int32 get_offset) { - // Not implemented in proxy. - NOTREACHED(); -} - scoped_refptr<gpu::Buffer> PpapiCommandBufferProxy::CreateTransferBuffer( size_t size, int32* id) { @@ -119,66 +114,18 @@ scoped_refptr<gpu::Buffer> PpapiCommandBufferProxy::CreateTransferBuffer( if (last_state_.error != gpu::error::kNoError) return NULL; - if (!Send(new PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer( - ppapi::API_ID_PPB_GRAPHICS_3D, resource_, size, id))) { - return NULL; - } - - if ((*id) <= 0) - return NULL; - - return GetTransferBuffer(*id); -} - -void PpapiCommandBufferProxy::DestroyTransferBuffer(int32 id) { - if (last_state_.error != gpu::error::kNoError) - return; - - // Remove the transfer buffer from the client side4 cache. - TransferBufferMap::iterator it = transfer_buffers_.find(id); - - // Remove reference to buffer, allowing the shared memory object to be - // deleted, closing the handle in the process. - if (it != transfer_buffers_.end()) - transfer_buffers_.erase(it); - - Send(new PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer( - ppapi::API_ID_PPB_GRAPHICS_3D, resource_, id)); -} - -void PpapiCommandBufferProxy::Echo(const base::Closure& callback) { - NOTREACHED(); -} - -uint32 PpapiCommandBufferProxy::CreateStreamTexture(uint32 texture_id) { - NOTREACHED(); - return 0; -} - -scoped_refptr<gpu::Buffer> PpapiCommandBufferProxy::GetTransferBuffer( - int32 id) { - if (last_state_.error != gpu::error::kNoError) - return NULL; - - // Check local cache to see if there is already a client side shared memory - // object for this id. - TransferBufferMap::iterator it = transfer_buffers_.find(id); - if (it != transfer_buffers_.end()) { - return it->second; - } - // Assuming we are in the renderer process, the service is responsible for // duplicating the handle. This might not be true for NaCl. ppapi::proxy::SerializedHandle handle( ppapi::proxy::SerializedHandle::SHARED_MEMORY); - if (!Send(new PpapiHostMsg_PPBGraphics3D_GetTransferBuffer( - ppapi::API_ID_PPB_GRAPHICS_3D, resource_, id, &handle))) { + if (!Send(new PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer( + ppapi::API_ID_PPB_GRAPHICS_3D, resource_, size, id, &handle))) { return NULL; } - if (!handle.is_shmem()) + + if (*id <= 0 || !handle.is_shmem()) return NULL; - // Cache the transfer buffer shared memory object client side. scoped_ptr<base::SharedMemory> shared_memory( new base::SharedMemory(handle.shmem(), false)); @@ -189,23 +136,24 @@ scoped_refptr<gpu::Buffer> PpapiCommandBufferProxy::GetTransferBuffer( } } - scoped_refptr<gpu::Buffer> buffer = - new gpu::Buffer(shared_memory.Pass(), handle.size()); - transfer_buffers_[id] = buffer; - return buffer; + return gpu::MakeBufferFromSharedMemory(shared_memory.Pass(), handle.size()); } -void PpapiCommandBufferProxy::SetToken(int32 token) { - NOTREACHED(); +void PpapiCommandBufferProxy::DestroyTransferBuffer(int32 id) { + if (last_state_.error != gpu::error::kNoError) + return; + + Send(new PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer( + ppapi::API_ID_PPB_GRAPHICS_3D, resource_, id)); } -void PpapiCommandBufferProxy::SetParseError(gpu::error::Error error) { +void PpapiCommandBufferProxy::Echo(const base::Closure& callback) { NOTREACHED(); } -void PpapiCommandBufferProxy::SetContextLostReason( - gpu::error::ContextLostReason reason) { +uint32 PpapiCommandBufferProxy::CreateStreamTexture(uint32 texture_id) { NOTREACHED(); + return 0; } uint32 PpapiCommandBufferProxy::InsertSyncPoint() { diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.h b/ppapi/proxy/ppapi_command_buffer_proxy.h index 3116306131..20a09a5c59 100644 --- a/ppapi/proxy/ppapi_command_buffer_proxy.h +++ b/ppapi/proxy/ppapi_command_buffer_proxy.h @@ -37,15 +37,9 @@ class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, virtual void WaitForTokenInRange(int32 start, int32 end) OVERRIDE; virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE; virtual void SetGetBuffer(int32 transfer_buffer_id) OVERRIDE; - virtual void SetGetOffset(int32 get_offset) OVERRIDE; virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, int32* id) OVERRIDE; virtual void DestroyTransferBuffer(int32 id) OVERRIDE; - virtual scoped_refptr<gpu::Buffer> GetTransferBuffer(int32 id) OVERRIDE; - virtual void SetToken(int32 token) OVERRIDE; - virtual void SetParseError(gpu::error::Error error) OVERRIDE; - virtual void SetContextLostReason(gpu::error::ContextLostReason reason) - OVERRIDE; // gpu::GpuControl implementation: virtual gpu::Capabilities GetCapabilities() OVERRIDE; @@ -70,9 +64,6 @@ class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, bool Send(IPC::Message* msg); void UpdateState(const gpu::CommandBuffer::State& state, bool success); - typedef base::hash_map<int32, scoped_refptr<gpu::Buffer> > TransferBufferMap; - TransferBufferMap transfer_buffers_; - State last_state_; HostResource resource_; diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 4366773c31..5c9f067ce5 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -22,7 +22,6 @@ #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_graphics_2d_dev.h" #include "ppapi/c/dev/ppb_truetype_font_dev.h" #include "ppapi/c/dev/ppb_url_util_dev.h" #include "ppapi/c/dev/ppp_printing_dev.h" @@ -90,8 +89,6 @@ IPC_ENUM_TRAITS_MAX_VALUE(PP_FileType, PP_FILETYPE_OTHER) IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_Permission) IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_SettingType) IPC_ENUM_TRAITS(PP_FlashSetting) -IPC_ENUM_TRAITS_MAX_VALUE(PP_Graphics2D_Dev_ResizeMode, - PP_GRAPHICS2D_DEV_RESIZEMODE_STRETCH) IPC_ENUM_TRAITS(PP_ImageDataFormat) IPC_ENUM_TRAITS(PP_InputEvent_MouseButton) IPC_ENUM_TRAITS(PP_InputEvent_Type) @@ -807,17 +804,14 @@ IPC_SYNC_MESSAGE_ROUTED3_2(PpapiHostMsg_PPBGraphics3D_WaitForGetOffsetInRange, IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBGraphics3D_AsyncFlush, ppapi::HostResource /* context */, int32 /* put_offset */) -IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer, +IPC_SYNC_MESSAGE_ROUTED2_2(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer, ppapi::HostResource /* context */, uint32 /* size */, - int32 /* id */) + int32 /* id */, + ppapi::proxy::SerializedHandle /* transfer_buffer */) IPC_SYNC_MESSAGE_ROUTED2_0(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer, ppapi::HostResource /* context */, int32 /* id */) -IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBGraphics3D_GetTransferBuffer, - ppapi::HostResource /* context */, - int32 /* id */, - ppapi::proxy::SerializedHandle /* transfer_buffer */) IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBGraphics3D_SwapBuffers, ppapi::HostResource /* graphics_3d */) IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBGraphics3D_InsertSyncPoint, @@ -1416,16 +1410,11 @@ IPC_MESSAGE_CONTROL3(PpapiHostMsg_Graphics2D_Scroll, PP_Point /* amount */) IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_ReplaceContents, ppapi::HostResource /* image_data */) -IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_Dev_SetScale, +IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_SetScale, float /* scale */) -IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_SetOffset, - PP_Point /* offset */) -IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_SetResizeMode, - PP_Graphics2D_Dev_ResizeMode /* resize_mode */) // Graphics2D, plugin -> host -> plugin -IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_Flush, - ppapi::ViewData /* view_data */) +IPC_MESSAGE_CONTROL0(PpapiHostMsg_Graphics2D_Flush) IPC_MESSAGE_CONTROL0(PpapiPluginMsg_Graphics2D_FlushAck) IPC_MESSAGE_CONTROL2(PpapiHostMsg_Graphics2D_ReadImageData, diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc index 847e294680..85692d4056 100644 --- a/ppapi/proxy/ppb_graphics_3d_proxy.cc +++ b/ppapi/proxy/ppb_graphics_3d_proxy.cc @@ -28,18 +28,10 @@ namespace { const int32 kCommandBufferSize = 1024 * 1024; const int32 kTransferBufferSize = 1024 * 1024; -base::SharedMemoryHandle TransportSHMHandleFromInt(Dispatcher* dispatcher, - int shm_handle) { - // TODO(piman): Change trusted interface to return a PP_FileHandle, those - // casts are ugly. +base::SharedMemoryHandle TransportSHMHandle(Dispatcher* dispatcher, + base::SharedMemory* shm) { base::PlatformFile source = -#if defined(OS_WIN) - reinterpret_cast<HANDLE>(static_cast<intptr_t>(shm_handle)); -#elif defined(OS_POSIX) - shm_handle; -#else - #error Not implemented. -#endif + IPC::PlatformFileForTransitToPlatformFile(shm->handle()); // Don't close the handle, it doesn't belong to us. return dispatcher->ShareHandleWithRemote(source, false); } @@ -84,20 +76,17 @@ PP_Bool Graphics3D::Flush(int32_t put_offset) { return PP_FALSE; } -int32_t Graphics3D::CreateTransferBuffer(uint32_t size) { - return PP_FALSE; +scoped_refptr<gpu::Buffer> Graphics3D::CreateTransferBuffer( + uint32_t size, + int32_t* id) { + *id = -1; + return NULL; } PP_Bool Graphics3D::DestroyTransferBuffer(int32_t id) { return PP_FALSE; } -PP_Bool Graphics3D::GetTransferBuffer(int32_t id, - int* shm_handle, - uint32_t* shm_size) { - return PP_FALSE; -} - gpu::CommandBuffer::State Graphics3D::WaitForTokenInRange(int32_t start, int32_t end) { return GetErrorState(); @@ -203,8 +192,6 @@ bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgCreateTransferBuffer) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer, OnMsgDestroyTransferBuffer) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_GetTransferBuffer, - OnMsgGetTransferBuffer) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SwapBuffers, OnMsgSwapBuffers) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_InsertSyncPoint, @@ -301,12 +288,24 @@ void PPB_Graphics3D_Proxy::OnMsgAsyncFlush(const HostResource& context, void PPB_Graphics3D_Proxy::OnMsgCreateTransferBuffer( const HostResource& context, uint32 size, - int32* id) { + int32* id, + ppapi::proxy::SerializedHandle* transfer_buffer) { + transfer_buffer->set_null_shmem(); EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); - if (enter.succeeded()) - *id = enter.object()->CreateTransferBuffer(size); - else + if (enter.succeeded()) { + scoped_refptr<gpu::Buffer> buffer = + enter.object()->CreateTransferBuffer(size, id); + if (!buffer) + return; + gpu::SharedMemoryBufferBacking* backing = + static_cast<gpu::SharedMemoryBufferBacking*>(buffer->backing()); + DCHECK(backing && backing->shared_memory()); + transfer_buffer->set_shmem( + TransportSHMHandle(dispatcher(), backing->shared_memory()), + buffer->size()); + } else { *id = -1; + } } void PPB_Graphics3D_Proxy::OnMsgDestroyTransferBuffer( @@ -317,23 +316,6 @@ void PPB_Graphics3D_Proxy::OnMsgDestroyTransferBuffer( enter.object()->DestroyTransferBuffer(id); } -void PPB_Graphics3D_Proxy::OnMsgGetTransferBuffer( - const HostResource& context, - int32 id, - ppapi::proxy::SerializedHandle* transfer_buffer) { - transfer_buffer->set_null_shmem(); - - EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); - int shm_handle = 0; - uint32_t shm_size = 0; - if (enter.succeeded() && - enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) { - transfer_buffer->set_shmem( - TransportSHMHandleFromInt(dispatcher(), shm_handle), - shm_size); - } -} - void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context) { EnterHostFromHostResourceForceCallback<PPB_Graphics3D_API> enter( context, callback_factory_, diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.h b/ppapi/proxy/ppb_graphics_3d_proxy.h index 70c96e90c6..f86b16d787 100644 --- a/ppapi/proxy/ppb_graphics_3d_proxy.h +++ b/ppapi/proxy/ppb_graphics_3d_proxy.h @@ -37,11 +37,9 @@ class Graphics3D : public PPB_Graphics3D_Shared { virtual PP_Bool SetGetBuffer(int32_t shm_id) OVERRIDE; virtual gpu::CommandBuffer::State GetState() OVERRIDE; virtual PP_Bool Flush(int32_t put_offset) OVERRIDE; - virtual int32_t CreateTransferBuffer(uint32_t size) OVERRIDE; + virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, + int32* id) OVERRIDE; virtual PP_Bool DestroyTransferBuffer(int32_t id) OVERRIDE; - virtual PP_Bool GetTransferBuffer(int32_t id, - int* shm_handle, - uint32_t* shm_size) OVERRIDE; virtual gpu::CommandBuffer::State WaitForTokenInRange(int32_t start, int32_t end) OVERRIDE; virtual gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start, @@ -96,14 +94,13 @@ class PPB_Graphics3D_Proxy : public InterfaceProxy { gpu::CommandBuffer::State* state, bool* success); void OnMsgAsyncFlush(const HostResource& context, int32 put_offset); - void OnMsgCreateTransferBuffer(const HostResource& context, - uint32 size, - int32* id); + void OnMsgCreateTransferBuffer( + const HostResource& context, + uint32 size, + int32* id, + ppapi::proxy::SerializedHandle* transfer_buffer); void OnMsgDestroyTransferBuffer(const HostResource& context, int32 id); - void OnMsgGetTransferBuffer(const HostResource& context, - int32 id, - ppapi::proxy::SerializedHandle* transfer_buffer); void OnMsgSwapBuffers(const HostResource& context); void OnMsgInsertSyncPoint(const HostResource& context, uint32* sync_point); // Renderer->plugin message handlers. diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.cc b/ppapi/shared_impl/ppb_graphics_3d_shared.cc index b4e258b3f8..1b3677b18c 100644 --- a/ppapi/shared_impl/ppb_graphics_3d_shared.cc +++ b/ppapi/shared_impl/ppb_graphics_3d_shared.cc @@ -118,6 +118,7 @@ bool PPB_Graphics3D_Shared::CreateGLES2Impl( transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get())); const bool bind_creates_resources = true; + const bool lose_context_when_out_of_memory = false; // Create the object exposing the OpenGL API. gles2_impl_.reset(new gpu::gles2::GLES2Implementation( @@ -125,6 +126,7 @@ bool PPB_Graphics3D_Shared::CreateGLES2Impl( share_gles2 ? share_gles2->share_group() : NULL, transfer_buffer_.get(), bind_creates_resources, + lose_context_when_out_of_memory, GetGpuControl())); if (!gles2_impl_->Initialize( diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h index b74675c98b..9444a2a7d1 100644 --- a/ppapi/tests/all_c_includes.h +++ b/ppapi/tests/all_c_includes.h @@ -20,7 +20,6 @@ #include "ppapi/c/dev/ppb_device_ref_dev.h" #include "ppapi/c/dev/ppb_file_chooser_dev.h" #include "ppapi/c/dev/ppb_font_dev.h" -#include "ppapi/c/dev/ppb_graphics_2d_dev.h" #include "ppapi/c/dev/ppb_ime_input_event_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" #include "ppapi/c/dev/ppb_printing_dev.h" diff --git a/ppapi/tests/all_cpp_includes.h b/ppapi/tests/all_cpp_includes.h index dcb907c36d..cae2083c5a 100644 --- a/ppapi/tests/all_cpp_includes.h +++ b/ppapi/tests/all_cpp_includes.h @@ -19,7 +19,6 @@ #include "ppapi/cpp/dev/device_ref_dev.h" #include "ppapi/cpp/dev/file_chooser_dev.h" #include "ppapi/cpp/dev/font_dev.h" -#include "ppapi/cpp/dev/graphics_2d_dev.h" #include "ppapi/cpp/dev/ime_input_event_dev.h" #include "ppapi/cpp/dev/may_own_ptr_dev.h" #include "ppapi/cpp/dev/memory_dev.h" diff --git a/ppapi/tests/test_graphics_2d.cc b/ppapi/tests/test_graphics_2d.cc index 5bb66d73b7..dfc10a60e5 100644 --- a/ppapi/tests/test_graphics_2d.cc +++ b/ppapi/tests/test_graphics_2d.cc @@ -12,8 +12,6 @@ #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_graphics_2d.h" #include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/dev/graphics_2d_dev.h" -#include "ppapi/cpp/dev/graphics_2d_dev.h" #include "ppapi/cpp/graphics_2d.h" #include "ppapi/cpp/graphics_3d.h" #include "ppapi/cpp/image_data.h" @@ -721,15 +719,14 @@ std::string TestGraphics2D::TestDev() { const float scale = 1.0f/2.0f; pp::Graphics2D dc(instance_, pp::Size(w, h), false); ASSERT_FALSE(dc.is_null()); - pp::Graphics2D_Dev dc_dev(dc); - ASSERT_EQ(1.0f, dc_dev.GetScale()); - ASSERT_TRUE(dc_dev.SetScale(scale)); - ASSERT_EQ(scale, dc_dev.GetScale()); + ASSERT_EQ(1.0f, dc.GetScale()); + ASSERT_TRUE(dc.SetScale(scale)); + ASSERT_EQ(scale, dc.GetScale()); // Try setting a few invalid scale factors. Ensure that we catch these errors // and don't change the actual scale - ASSERT_FALSE(dc_dev.SetScale(-1.0f)); - ASSERT_FALSE(dc_dev.SetScale(0.0f)); - ASSERT_EQ(scale, dc_dev.GetScale()); + ASSERT_FALSE(dc.SetScale(-1.0f)); + ASSERT_FALSE(dc.SetScale(0.0f)); + ASSERT_EQ(scale, dc.GetScale()); // Verify that the context has the specified number of pixels, despite the // non-identity scale @@ -737,7 +734,7 @@ std::string TestGraphics2D::TestDev() { size.width = -1; size.height = -1; PP_Bool is_always_opaque = PP_FALSE; - ASSERT_TRUE(graphics_2d_interface_->Describe(dc_dev.pp_resource(), &size, + ASSERT_TRUE(graphics_2d_interface_->Describe(dc.pp_resource(), &size, &is_always_opaque)); ASSERT_EQ(w, size.width); ASSERT_EQ(h, size.height); diff --git a/ppapi/thunk/interfaces_ppb_private.h b/ppapi/thunk/interfaces_ppb_private.h index 76c23c04b8..7e3988ef7e 100644 --- a/ppapi/thunk/interfaces_ppb_private.h +++ b/ppapi/thunk/interfaces_ppb_private.h @@ -33,6 +33,8 @@ PROXIED_IFACE(PPB_FILECHOOSER_TRUSTED_INTERFACE_0_6, PPB_FileChooserTrusted_0_6) PROXIED_IFACE(PPB_FILEREFPRIVATE_INTERFACE_0_1, PPB_FileRefPrivate_0_1) +PROXIED_IFACE(PPB_FIND_PRIVATE_INTERFACE_0_3, + PPB_Find_Private_0_3) PROXIED_IFACE(PPB_FLASHFULLSCREEN_INTERFACE_0_1, PPB_FlashFullscreen_0_1) PROXIED_IFACE(PPB_FLASHFULLSCREEN_INTERFACE_1_0, diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h index 39855b9c42..6821b3ab72 100644 --- a/ppapi/thunk/interfaces_ppb_public_dev.h +++ b/ppapi/thunk/interfaces_ppb_public_dev.h @@ -38,8 +38,6 @@ PROXIED_IFACE(PPB_CRYPTO_DEV_INTERFACE_0_1, PPB_Crypto_Dev_0_1) PROXIED_IFACE(PPB_DEVICEREF_DEV_INTERFACE_0_1, PPB_DeviceRef_Dev_0_1) PROXIED_IFACE(PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE_0_1, PPB_GLESChromiumTextureMapping_Dev_0_1) -PROXIED_IFACE(PPB_GRAPHICS2D_DEV_INTERFACE_0_1, PPB_Graphics2D_Dev_0_1) -PROXIED_IFACE(PPB_GRAPHICS2D_DEV_INTERFACE_0_2, PPB_Graphics2D_Dev_0_2) PROXIED_IFACE(PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_1, PPB_IMEInputEvent_Dev_0_1) PROXIED_IFACE(PPB_SCROLLBAR_DEV_INTERFACE_0_5, PPB_Scrollbar_Dev_0_5) PROXIED_IFACE(PPB_TEXTINPUT_DEV_INTERFACE_0_1, PPB_TextInput_Dev_0_1) diff --git a/ppapi/thunk/ppb_graphics_2d_api.h b/ppapi/thunk/ppb_graphics_2d_api.h index 0709a50ba9..cdb07cce80 100644 --- a/ppapi/thunk/ppb_graphics_2d_api.h +++ b/ppapi/thunk/ppb_graphics_2d_api.h @@ -6,7 +6,6 @@ #define PPAPI_THUNK_PPB_GRAPHICS_2D_API_H_ #include "base/memory/ref_counted.h" -#include "ppapi/c/dev/ppb_graphics_2d_dev.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_point.h" @@ -33,12 +32,8 @@ class PPAPI_THUNK_EXPORT PPB_Graphics2D_API { const PP_Point* amount) = 0; virtual void ReplaceContents(PP_Resource image_data) = 0; virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) = 0; - - // Dev interface. virtual PP_Bool SetScale(float scale) = 0; virtual float GetScale() = 0; - virtual void SetOffset(const PP_Point* offset) = 0; - virtual void SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode) = 0; // Test only virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0; diff --git a/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc b/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc deleted file mode 100644 index 8e9a07c58b..0000000000 --- a/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2012 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 dev/ppb_graphics_2d_dev.idl modified Mon Nov 25 11:02:23 2013. - -#include "ppapi/c/dev/ppb_graphics_2d_dev.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/shared_impl/tracked_callback.h" -#include "ppapi/thunk/enter.h" -#include "ppapi/thunk/ppapi_thunk_export.h" -#include "ppapi/thunk/ppb_graphics_2d_api.h" - -namespace ppapi { -namespace thunk { - -namespace { - -PP_Bool SetScale(PP_Resource resource, float scale) { - VLOG(4) << "PPB_Graphics2D_Dev::SetScale()"; - EnterResource<PPB_Graphics2D_API> enter(resource, true); - if (enter.failed()) - return PP_FALSE; - return enter.object()->SetScale(scale); -} - -float GetScale(PP_Resource resource) { - VLOG(4) << "PPB_Graphics2D_Dev::GetScale()"; - EnterResource<PPB_Graphics2D_API> enter(resource, true); - if (enter.failed()) - return 0.0f; - return enter.object()->GetScale(); -} - -void SetOffset(PP_Resource resource, const struct PP_Point* offset) { - VLOG(4) << "PPB_Graphics2D_Dev::SetOffset()"; - EnterResource<PPB_Graphics2D_API> enter(resource, true); - if (enter.failed()) - return; - enter.object()->SetOffset(offset); -} - -void SetResizeMode(PP_Resource resource, - PP_Graphics2D_Dev_ResizeMode resize_mode) { - VLOG(4) << "PPB_Graphics2D_Dev::SetResizeMode()"; - EnterResource<PPB_Graphics2D_API> enter(resource, true); - if (enter.failed()) - return; - enter.object()->SetResizeMode(resize_mode); -} - -const PPB_Graphics2D_Dev_0_1 g_ppb_graphics2d_dev_thunk_0_1 = { - &SetScale, - &GetScale, - &SetResizeMode -}; - -const PPB_Graphics2D_Dev_0_2 g_ppb_graphics2d_dev_thunk_0_2 = { - &SetScale, - &GetScale, - &SetOffset, - &SetResizeMode -}; - -} // namespace - -PPAPI_THUNK_EXPORT const PPB_Graphics2D_Dev_0_1* - GetPPB_Graphics2D_Dev_0_1_Thunk() { - return &g_ppb_graphics2d_dev_thunk_0_1; -} - -PPAPI_THUNK_EXPORT const PPB_Graphics2D_Dev_0_2* - GetPPB_Graphics2D_Dev_0_2_Thunk() { - return &g_ppb_graphics2d_dev_thunk_0_2; -} - -} // namespace thunk -} // namespace ppapi diff --git a/ppapi/thunk/ppb_graphics_3d_api.h b/ppapi/thunk/ppb_graphics_3d_api.h index a88b4abbbe..92e392e290 100644 --- a/ppapi/thunk/ppb_graphics_3d_api.h +++ b/ppapi/thunk/ppb_graphics_3d_api.h @@ -32,11 +32,9 @@ class PPAPI_THUNK_EXPORT PPB_Graphics3D_API { // Graphics3DTrusted API. virtual PP_Bool SetGetBuffer(int32_t shm_id) = 0; virtual gpu::CommandBuffer::State GetState() = 0; - virtual int32_t CreateTransferBuffer(uint32_t size) = 0; + virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, + int32_t* id) = 0; virtual PP_Bool DestroyTransferBuffer(int32_t id) = 0; - virtual PP_Bool GetTransferBuffer(int32_t id, - int* shm_handle, - uint32_t* shm_size) = 0; virtual PP_Bool Flush(int32_t put_offset) = 0; virtual gpu::CommandBuffer::State WaitForTokenInRange(int32_t start, int32_t end) = 0; |