diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-22 08:06:26 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-22 08:06:26 +0000 |
commit | 665b5c54dd232d63620438e8941925b1ac1e52f4 (patch) | |
tree | 414b08e4b427946ac246ea786c8b64c6efc07736 /ppapi | |
parent | a2936b92f30b8a343bb5e8d18f95628b32c31100 (diff) | |
download | chromium_src-665b5c54dd232d63620438e8941925b1ac1e52f4.zip chromium_src-665b5c54dd232d63620438e8941925b1ac1e52f4.tar.gz chromium_src-665b5c54dd232d63620438e8941925b1ac1e52f4.tar.bz2 |
PPAPI: Use clang-format on ppapi/shared_impl
This does not yet add the presubmit check. I'll do that when more of ppapi/ is converted.
BUG=345417
Review URL: https://codereview.chromium.org/174213003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252768 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
93 files changed, 1209 insertions, 1442 deletions
diff --git a/ppapi/shared_impl/api_id.h b/ppapi/shared_impl/api_id.h index cf1395b..dd19bb7 100644 --- a/ppapi/shared_impl/api_id.h +++ b/ppapi/shared_impl/api_id.h @@ -46,7 +46,6 @@ enum ApiID { API_ID_PPB_VIDEO_CAPTURE_DEV, API_ID_PPB_VIDEO_DECODER_DEV, API_ID_PPB_X509_CERTIFICATE_PRIVATE, - API_ID_PPP_CLASS, // TODO(tomfinegan): Remove this after we refactor things to load the PPP // interface struct from the PPB interface. @@ -62,7 +61,6 @@ enum ApiID { API_ID_PPP_TEXT_INPUT, API_ID_PPP_VIDEO_CAPTURE_DEV, API_ID_PPP_VIDEO_DECODER_DEV, - API_ID_RESOURCE_CREATION, // Must be last to indicate the number of interface IDs. diff --git a/ppapi/shared_impl/array_var.cc b/ppapi/shared_impl/array_var.cc index def1bb5..6207379 100644 --- a/ppapi/shared_impl/array_var.cc +++ b/ppapi/shared_impl/array_var.cc @@ -13,11 +13,9 @@ namespace ppapi { -ArrayVar::ArrayVar() { -} +ArrayVar::ArrayVar() {} -ArrayVar::~ArrayVar() { -} +ArrayVar::~ArrayVar() {} // static ArrayVar* ArrayVar::FromPPVar(const PP_Var& var) { @@ -31,13 +29,9 @@ ArrayVar* ArrayVar::FromPPVar(const PP_Var& var) { return var_object->AsArrayVar(); } -ArrayVar* ArrayVar::AsArrayVar() { - return this; -} +ArrayVar* ArrayVar::AsArrayVar() { return this; } -PP_VarType ArrayVar::GetType() const { - return PP_VARTYPE_ARRAY; -} +PP_VarType ArrayVar::GetType() const { return PP_VARTYPE_ARRAY; } PP_Var ArrayVar::Get(uint32_t index) const { if (index >= elements_.size()) diff --git a/ppapi/shared_impl/array_var.h b/ppapi/shared_impl/array_var.h index 1214d87..673fbff 100644 --- a/ppapi/shared_impl/array_var.h +++ b/ppapi/shared_impl/array_var.h @@ -37,13 +37,9 @@ class PPAPI_SHARED_EXPORT ArrayVar : public Var { uint32_t GetLength() const; PP_Bool SetLength(uint32_t length); - const ElementVector& elements() const { - return elements_; - } + const ElementVector& elements() const { return elements_; } - ElementVector& elements() { - return elements_; - } + ElementVector& elements() { return elements_; } protected: virtual ~ArrayVar(); diff --git a/ppapi/shared_impl/array_writer.cc b/ppapi/shared_impl/array_writer.cc index 26ee1bd..fe87e07 100644 --- a/ppapi/shared_impl/array_writer.cc +++ b/ppapi/shared_impl/array_writer.cc @@ -14,16 +14,12 @@ namespace ppapi { -ArrayWriter::ArrayWriter() { - Reset(); -} +ArrayWriter::ArrayWriter() { Reset(); } ArrayWriter::ArrayWriter(const PP_ArrayOutput& output) - : pp_array_output_(output) { -} + : pp_array_output_(output) {} -ArrayWriter::~ArrayWriter() { -} +ArrayWriter::~ArrayWriter() {} void ArrayWriter::Reset() { pp_array_output_.GetDataBuffer = NULL; @@ -31,12 +27,12 @@ void ArrayWriter::Reset() { } bool ArrayWriter::StoreResourceVector( - const std::vector< scoped_refptr<Resource> >& input) { + const std::vector<scoped_refptr<Resource> >& input) { // Always call the alloc function, even on 0 array size. - void* dest = pp_array_output_.GetDataBuffer( - pp_array_output_.user_data, - static_cast<uint32_t>(input.size()), - sizeof(PP_Resource)); + void* dest = + pp_array_output_.GetDataBuffer(pp_array_output_.user_data, + static_cast<uint32_t>(input.size()), + sizeof(PP_Resource)); // Regardless of success, we clear the output to prevent future calls on // this same output object. @@ -56,10 +52,10 @@ bool ArrayWriter::StoreResourceVector( bool ArrayWriter::StoreResourceVector(const std::vector<PP_Resource>& input) { // Always call the alloc function, even on 0 array size. - void* dest = pp_array_output_.GetDataBuffer( - pp_array_output_.user_data, - static_cast<uint32_t>(input.size()), - sizeof(PP_Resource)); + void* dest = + pp_array_output_.GetDataBuffer(pp_array_output_.user_data, + static_cast<uint32_t>(input.size()), + sizeof(PP_Resource)); // Regardless of success, we clear the output to prevent future calls on // this same output object. @@ -79,12 +75,12 @@ bool ArrayWriter::StoreResourceVector(const std::vector<PP_Resource>& input) { } bool ArrayWriter::StoreVarVector( - const std::vector< scoped_refptr<Var> >& input) { + const std::vector<scoped_refptr<Var> >& input) { // Always call the alloc function, even on 0 array size. - void* dest = pp_array_output_.GetDataBuffer( - pp_array_output_.user_data, - static_cast<uint32_t>(input.size()), - sizeof(PP_Var)); + void* dest = + pp_array_output_.GetDataBuffer(pp_array_output_.user_data, + static_cast<uint32_t>(input.size()), + sizeof(PP_Var)); // Regardless of success, we clear the output to prevent future calls on // this same output object. @@ -104,10 +100,10 @@ bool ArrayWriter::StoreVarVector( bool ArrayWriter::StoreVarVector(const std::vector<PP_Var>& input) { // Always call the alloc function, even on 0 array size. - void* dest = pp_array_output_.GetDataBuffer( - pp_array_output_.user_data, - static_cast<uint32_t>(input.size()), - sizeof(PP_Var)); + void* dest = + pp_array_output_.GetDataBuffer(pp_array_output_.user_data, + static_cast<uint32_t>(input.size()), + sizeof(PP_Var)); // Regardless of success, we clear the output to prevent future calls on // this same output object. diff --git a/ppapi/shared_impl/array_writer.h b/ppapi/shared_impl/array_writer.h index 7e6c349..fce10e4 100644 --- a/ppapi/shared_impl/array_writer.h +++ b/ppapi/shared_impl/array_writer.h @@ -54,9 +54,7 @@ class PPAPI_SHARED_EXPORT ArrayWriter { bool StoreArray(const T* input, uint32_t count) { // Always call the alloc function, even on 0 array size. void* dest = pp_array_output_.GetDataBuffer( - pp_array_output_.user_data, - count, - sizeof(T)); + pp_array_output_.user_data, count, sizeof(T)); // Regardless of success, we clear the output to prevent future calls on // this same output object. @@ -74,7 +72,7 @@ class PPAPI_SHARED_EXPORT ArrayWriter { // Copies the given array/vector of data to the plugin output array. See // comment of StoreArray() for detail. - template<typename T> + template <typename T> bool StoreVector(const std::vector<T>& input) { return StoreArray(input.size() ? &input[0] : NULL, input.size()); } @@ -90,7 +88,7 @@ class PPAPI_SHARED_EXPORT ArrayWriter { // Note: potentially this could be a template in case you have a vector of // FileRef objects, for example. However, this saves code since there's only // one instantiation and is sufficient for now. - bool StoreResourceVector(const std::vector< scoped_refptr<Resource> >& input); + bool StoreResourceVector(const std::vector<scoped_refptr<Resource> >& input); // Like the above version but takes an array of AddRef'ed PP_Resources. On // storage failure, this will release each resource. @@ -103,7 +101,7 @@ class PPAPI_SHARED_EXPORT ArrayWriter { // refcounts will be unchanged. In either case, the object will become // is_null() immediately after the call since one output function should only // be issued once. - bool StoreVarVector(const std::vector< scoped_refptr<Var> >& input); + bool StoreVarVector(const std::vector<scoped_refptr<Var> >& input); // Like the above version but takes an array of AddRef'ed PP_Vars. On // storage failure, this will release each var. diff --git a/ppapi/shared_impl/callback_tracker.cc b/ppapi/shared_impl/callback_tracker.cc index 6857c4c..feefb0e 100644 --- a/ppapi/shared_impl/callback_tracker.cc +++ b/ppapi/shared_impl/callback_tracker.cc @@ -17,17 +17,18 @@ namespace ppapi { // CallbackTracker ------------------------------------------------------------- -CallbackTracker::CallbackTracker() { -} +CallbackTracker::CallbackTracker() {} void CallbackTracker::AbortAll() { // Iterate over a copy since |Abort()| calls |Remove()| (indirectly). // TODO(viettrungluu): This obviously isn't so efficient. CallbackSetMap pending_callbacks_copy = pending_callbacks_; for (CallbackSetMap::iterator it1 = pending_callbacks_copy.begin(); - it1 != pending_callbacks_copy.end(); ++it1) { + it1 != pending_callbacks_copy.end(); + ++it1) { for (CallbackSet::iterator it2 = it1->second.begin(); - it2 != it1->second.end(); ++it2) { + it2 != it1->second.end(); + ++it2) { (*it2)->Abort(); } } @@ -39,7 +40,8 @@ void CallbackTracker::PostAbortForResource(PP_Resource resource_id) { if (it1 == pending_callbacks_.end()) return; for (CallbackSet::iterator it2 = it1->second.begin(); - it2 != it1->second.end(); ++it2) { + it2 != it1->second.end(); + ++it2) { // Post the abort. (*it2)->PostAbort(); } diff --git a/ppapi/shared_impl/dictionary_var.cc b/ppapi/shared_impl/dictionary_var.cc index 6a66ea3..54d2010 100644 --- a/ppapi/shared_impl/dictionary_var.cc +++ b/ppapi/shared_impl/dictionary_var.cc @@ -12,11 +12,9 @@ namespace ppapi { -DictionaryVar::DictionaryVar() { -} +DictionaryVar::DictionaryVar() {} -DictionaryVar::~DictionaryVar() { -} +DictionaryVar::~DictionaryVar() {} // static DictionaryVar* DictionaryVar::FromPPVar(const PP_Var& var) { @@ -30,13 +28,9 @@ DictionaryVar* DictionaryVar::FromPPVar(const PP_Var& var) { return var_object->AsDictionaryVar(); } -DictionaryVar* DictionaryVar::AsDictionaryVar() { - return this; -} +DictionaryVar* DictionaryVar::AsDictionaryVar() { return this; } -PP_VarType DictionaryVar::GetType() const { - return PP_VARTYPE_DICTIONARY; -} +PP_VarType DictionaryVar::GetType() const { return PP_VARTYPE_DICTIONARY; } PP_Var DictionaryVar::Get(const PP_Var& key) const { StringVar* string_var = StringVar::FromPPVar(key); @@ -86,10 +80,10 @@ PP_Var DictionaryVar::GetKeys() const { array_var->elements().reserve(key_value_map_.size()); for (KeyValueMap::const_iterator iter = key_value_map_.begin(); - iter != key_value_map_.end(); ++iter) { - array_var->elements().push_back( - ScopedPPVar(ScopedPPVar::PassRef(), - StringVar::StringToPPVar(iter->first))); + iter != key_value_map_.end(); + ++iter) { + array_var->elements().push_back(ScopedPPVar( + ScopedPPVar::PassRef(), StringVar::StringToPPVar(iter->first))); } return array_var->GetPPVar(); } diff --git a/ppapi/shared_impl/dictionary_var.h b/ppapi/shared_impl/dictionary_var.h index cdc63bd..728bae1 100644 --- a/ppapi/shared_impl/dictionary_var.h +++ b/ppapi/shared_impl/dictionary_var.h @@ -45,9 +45,7 @@ class PPAPI_SHARED_EXPORT DictionaryVar : public Var { bool SetWithStringKey(const std::string& utf8_key, const PP_Var& value); void DeleteWithStringKey(const std::string& utf8_key); - const KeyValueMap& key_value_map() const { - return key_value_map_; - } + const KeyValueMap& key_value_map() const { return key_value_map_; } protected: virtual ~DictionaryVar(); diff --git a/ppapi/shared_impl/dir_contents.h b/ppapi/shared_impl/dir_contents.h index 4d895b5..fd4cd20 100644 --- a/ppapi/shared_impl/dir_contents.h +++ b/ppapi/shared_impl/dir_contents.h @@ -5,7 +5,6 @@ #ifndef PPAPI_SHARED_IMPL_DIR_CONTENTS_H_ #define PPAPI_SHARED_IMPL_DIR_CONTENTS_H_ - #include <vector> #include "base/files/file_path.h" diff --git a/ppapi/shared_impl/file_growth.cc b/ppapi/shared_impl/file_growth.cc index ac97506..79f6b5c 100644 --- a/ppapi/shared_impl/file_growth.cc +++ b/ppapi/shared_impl/file_growth.cc @@ -8,10 +8,7 @@ namespace ppapi { -FileGrowth::FileGrowth() - : max_written_offset(0), - append_mode_write_amount(0) { -} +FileGrowth::FileGrowth() : max_written_offset(0), append_mode_write_amount(0) {} FileGrowth::FileGrowth(int64_t max_written_offset, int64_t append_mode_write_amount) @@ -25,7 +22,8 @@ FileGrowthMap FileSizeMapToFileGrowthMapForTesting( const FileSizeMap& file_sizes) { FileGrowthMap file_growths; for (FileSizeMap::const_iterator it = file_sizes.begin(); - it != file_sizes.end(); ++it) + it != file_sizes.end(); + ++it) file_growths[it->first] = FileGrowth(it->second, 0); return file_growths; } @@ -34,7 +32,8 @@ FileSizeMap FileGrowthMapToFileSizeMapForTesting( const FileGrowthMap& file_growths) { FileSizeMap file_sizes; for (FileGrowthMap::const_iterator it = file_growths.begin(); - it != file_growths.end(); ++it) + it != file_growths.end(); + ++it) file_sizes[it->first] = it->second.max_written_offset; return file_sizes; } diff --git a/ppapi/shared_impl/file_growth.h b/ppapi/shared_impl/file_growth.h index 23f12e0..b2c3ed4 100644 --- a/ppapi/shared_impl/file_growth.h +++ b/ppapi/shared_impl/file_growth.h @@ -23,10 +23,10 @@ struct PPAPI_SHARED_EXPORT FileGrowth { typedef std::map<int32_t, FileGrowth> FileGrowthMap; typedef std::map<int32_t, int64_t> FileSizeMap; -PPAPI_SHARED_EXPORT FileGrowthMap FileSizeMapToFileGrowthMapForTesting( - const FileSizeMap& file_sizes); -PPAPI_SHARED_EXPORT FileSizeMap FileGrowthMapToFileSizeMapForTesting( - const FileGrowthMap& file_growths); +PPAPI_SHARED_EXPORT FileGrowthMap + FileSizeMapToFileGrowthMapForTesting(const FileSizeMap& file_sizes); +PPAPI_SHARED_EXPORT FileSizeMap + FileGrowthMapToFileSizeMapForTesting(const FileGrowthMap& file_growths); } // namespace ppapi diff --git a/ppapi/shared_impl/file_io_state_manager.cc b/ppapi/shared_impl/file_io_state_manager.cc index 9c9b6ea..c705f84 100644 --- a/ppapi/shared_impl/file_io_state_manager.cc +++ b/ppapi/shared_impl/file_io_state_manager.cc @@ -10,17 +10,11 @@ namespace ppapi { FileIOStateManager::FileIOStateManager() - : num_pending_ops_(0), - pending_op_(OPERATION_NONE), - file_open_(false) { -} + : num_pending_ops_(0), pending_op_(OPERATION_NONE), file_open_(false) {} -FileIOStateManager::~FileIOStateManager() { -} +FileIOStateManager::~FileIOStateManager() {} -void FileIOStateManager::SetOpenSucceed() { - file_open_ = true; -} +void FileIOStateManager::SetOpenSucceed() { file_open_ = true; } int32_t FileIOStateManager::CheckOperationState(OperationType new_op, bool should_be_open) { @@ -53,4 +47,3 @@ void FileIOStateManager::SetOperationFinished() { } } // namespace ppapi - diff --git a/ppapi/shared_impl/file_io_state_manager.h b/ppapi/shared_impl/file_io_state_manager.h index 7b5f926..1c4fa1a 100644 --- a/ppapi/shared_impl/file_io_state_manager.h +++ b/ppapi/shared_impl/file_io_state_manager.h @@ -66,4 +66,3 @@ class PPAPI_SHARED_EXPORT FileIOStateManager { } // namespace ppapi #endif // PPAPI_SHARED_IMPL_FILE_IO_STATE_MANAGER_H_ - diff --git a/ppapi/shared_impl/file_path.cc b/ppapi/shared_impl/file_path.cc index d05b1b3..248893a 100644 --- a/ppapi/shared_impl/file_path.cc +++ b/ppapi/shared_impl/file_path.cc @@ -6,14 +6,10 @@ namespace ppapi { -PepperFilePath::PepperFilePath() - : domain_(DOMAIN_INVALID), - path_() { -} +PepperFilePath::PepperFilePath() : domain_(DOMAIN_INVALID), path_() {} PepperFilePath::PepperFilePath(Domain domain, const base::FilePath& path) - : domain_(domain), - path_(path) { + : domain_(domain), path_(path) { // TODO(viettrungluu): Should we DCHECK() some things here? } diff --git a/ppapi/shared_impl/file_ref_create_info.cc b/ppapi/shared_impl/file_ref_create_info.cc index 2fd3e13..7d975b7 100644 --- a/ppapi/shared_impl/file_ref_create_info.cc +++ b/ppapi/shared_impl/file_ref_create_info.cc @@ -31,11 +31,11 @@ bool FileRefCreateInfo::IsValid() const { return file_system_type != PP_FILESYSTEMTYPE_INVALID; } -FileRefCreateInfo -MakeExternalFileRefCreateInfo(const base::FilePath& external_path, - const std::string& display_name, - int browser_pending_host_resource_id, - int renderer_pending_host_resource_id) { +FileRefCreateInfo MakeExternalFileRefCreateInfo( + const base::FilePath& external_path, + const std::string& display_name, + int browser_pending_host_resource_id, + int renderer_pending_host_resource_id) { FileRefCreateInfo info; info.file_system_type = PP_FILESYSTEMTYPE_EXTERNAL; if (!display_name.empty()) diff --git a/ppapi/shared_impl/file_ref_create_info.h b/ppapi/shared_impl/file_ref_create_info.h index 02fc8cc..a3cb466 100644 --- a/ppapi/shared_impl/file_ref_create_info.h +++ b/ppapi/shared_impl/file_ref_create_info.h @@ -17,10 +17,11 @@ namespace ppapi { // FileRefs are created in a number of places and they include a number of // return values. This struct encapsulates everything in one place. struct FileRefCreateInfo { - FileRefCreateInfo() : file_system_type(PP_FILESYSTEMTYPE_INVALID), - browser_pending_host_resource_id(0), - renderer_pending_host_resource_id(0), - file_system_plugin_resource(0) { } + FileRefCreateInfo() + : file_system_type(PP_FILESYSTEMTYPE_INVALID), + browser_pending_host_resource_id(0), + renderer_pending_host_resource_id(0), + file_system_plugin_resource(0) {} PPAPI_SHARED_EXPORT bool IsValid() const; @@ -41,10 +42,10 @@ struct FileRefCreateInfo { // Used in the renderer when sending a FileRefCreateInfo to a plugin for a // FileRef on an external filesystem. PPAPI_SHARED_EXPORT FileRefCreateInfo -MakeExternalFileRefCreateInfo(const base::FilePath& external_path, - const std::string& display_name, - int browser_pending_host_resource_id, - int renderer_pending_host_resource_id); + MakeExternalFileRefCreateInfo(const base::FilePath& external_path, + const std::string& display_name, + int browser_pending_host_resource_id, + int renderer_pending_host_resource_id); } // namespace ppapi diff --git a/ppapi/shared_impl/file_type_conversion.h b/ppapi/shared_impl/file_type_conversion.h index 7c5454d..d49831a 100644 --- a/ppapi/shared_impl/file_type_conversion.h +++ b/ppapi/shared_impl/file_type_conversion.h @@ -22,10 +22,9 @@ PPAPI_SHARED_EXPORT bool PepperFileOpenFlagsToPlatformFileFlags( int32_t pp_open_flags, int* flags_out); -PPAPI_SHARED_EXPORT void FileInfoToPepperFileInfo( - const base::File::Info& info, - PP_FileSystemType fs_type, - PP_FileInfo* info_out); +PPAPI_SHARED_EXPORT void FileInfoToPepperFileInfo(const base::File::Info& info, + PP_FileSystemType fs_type, + PP_FileInfo* info_out); } // namespace ppapi diff --git a/ppapi/shared_impl/flash_clipboard_format_registry.cc b/ppapi/shared_impl/flash_clipboard_format_registry.cc index a5d50c6..89a051e 100644 --- a/ppapi/shared_impl/flash_clipboard_format_registry.cc +++ b/ppapi/shared_impl/flash_clipboard_format_registry.cc @@ -17,11 +17,8 @@ const size_t kMaxFormatNameLength = 50; // All formats in PP_Flash_Clipboard_Format should be added here. const PP_Flash_Clipboard_Format kPredefinedFormats[] = { - PP_FLASH_CLIPBOARD_FORMAT_INVALID, - PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT, - PP_FLASH_CLIPBOARD_FORMAT_HTML, - PP_FLASH_CLIPBOARD_FORMAT_RTF -}; + PP_FLASH_CLIPBOARD_FORMAT_INVALID, PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT, + PP_FLASH_CLIPBOARD_FORMAT_HTML, PP_FLASH_CLIPBOARD_FORMAT_RTF}; // The first custom format ID will be the ID after that max value in // PP_Flash_Clipboard_Format. @@ -36,11 +33,9 @@ bool IsValidFormatName(const std::string& format_name) { } // namespace -FlashClipboardFormatRegistry::FlashClipboardFormatRegistry() { -} +FlashClipboardFormatRegistry::FlashClipboardFormatRegistry() {} -FlashClipboardFormatRegistry::~FlashClipboardFormatRegistry() { -} +FlashClipboardFormatRegistry::~FlashClipboardFormatRegistry() {} uint32_t FlashClipboardFormatRegistry::RegisterFormat( const std::string& format_name) { @@ -63,8 +58,7 @@ bool FlashClipboardFormatRegistry::IsFormatRegistered(uint32_t format) const { return custom_formats_.find(format) != custom_formats_.end(); } -std::string FlashClipboardFormatRegistry::GetFormatName( - uint32_t format) const { +std::string FlashClipboardFormatRegistry::GetFormatName(uint32_t format) const { FormatMap::const_iterator it = custom_formats_.find(format); if (it == custom_formats_.end()) return std::string(); @@ -74,7 +68,8 @@ std::string FlashClipboardFormatRegistry::GetFormatName( uint32_t FlashClipboardFormatRegistry::GetFormatID( const std::string& format_name) const { for (FormatMap::const_iterator it = custom_formats_.begin(); - it != custom_formats_.end(); ++it) { + it != custom_formats_.end(); + ++it) { if (it->second == format_name) return it->first; } diff --git a/ppapi/shared_impl/flash_clipboard_format_registry.h b/ppapi/shared_impl/flash_clipboard_format_registry.h index 90520ea..9e9ae30 100644 --- a/ppapi/shared_impl/flash_clipboard_format_registry.h +++ b/ppapi/shared_impl/flash_clipboard_format_registry.h @@ -62,4 +62,3 @@ class PPAPI_SHARED_EXPORT FlashClipboardFormatRegistry { } // ppapi #endif // PPAPI_SHARED_IMPL_FLASH_CLIPBOARD_FORMAT_REGISTRY_H_ - diff --git a/ppapi/shared_impl/host_resource.cc b/ppapi/shared_impl/host_resource.cc index 031a5f0..ef15270 100644 --- a/ppapi/shared_impl/host_resource.cc +++ b/ppapi/shared_impl/host_resource.cc @@ -6,8 +6,7 @@ namespace ppapi { -HostResource::HostResource() : instance_(0), host_resource_(0) { -} +HostResource::HostResource() : instance_(0), host_resource_(0) {} // static HostResource HostResource::MakeInstanceOnly(PP_Instance instance) { @@ -22,4 +21,3 @@ void HostResource::SetHostResource(PP_Instance instance, PP_Resource resource) { } } // namespace ppapi - diff --git a/ppapi/shared_impl/host_resource.h b/ppapi/shared_impl/host_resource.h index 6001bb0f..6770a52 100644 --- a/ppapi/shared_impl/host_resource.h +++ b/ppapi/shared_impl/host_resource.h @@ -39,9 +39,7 @@ class PPAPI_SHARED_EXPORT HostResource { public: HostResource(); - bool is_null() const { - return !host_resource_; - } + bool is_null() const { return !host_resource_; } // Some resources are plugin-side only and don't have a corresponding // resource in the host. Yet these resources still need an instance to be @@ -55,9 +53,7 @@ class PPAPI_SHARED_EXPORT HostResource { // DO NOT CALL THESE FUNCTIONS IN THE PLUGIN SIDE OF THE PROXY. The values // will be invalid. See the class comment above. void SetHostResource(PP_Instance instance, PP_Resource resource); - PP_Resource host_resource() const { - return host_resource_; - } + PP_Resource host_resource() const { return host_resource_; } PP_Instance instance() const { return instance_; } diff --git a/ppapi/shared_impl/id_assignment.cc b/ppapi/shared_impl/id_assignment.cc index 9d36822..363dbb4 100644 --- a/ppapi/shared_impl/id_assignment.cc +++ b/ppapi/shared_impl/id_assignment.cc @@ -12,7 +12,7 @@ const unsigned int kPPIdTypeBits = 2; const int32 kMaxPPId = kint32max >> kPPIdTypeBits; -COMPILE_ASSERT(PP_ID_TYPE_COUNT <= (1<<kPPIdTypeBits), +COMPILE_ASSERT(PP_ID_TYPE_COUNT <= (1 << kPPIdTypeBits), kPPIdTypeBits_is_too_small_for_all_id_types); } // namespace ppapi diff --git a/ppapi/shared_impl/id_assignment.h b/ppapi/shared_impl/id_assignment.h index 3bacac3..4ca8cd1 100644 --- a/ppapi/shared_impl/id_assignment.h +++ b/ppapi/shared_impl/id_assignment.h @@ -27,11 +27,13 @@ PPAPI_SHARED_EXPORT extern const unsigned int kPPIdTypeBits; extern const int32 kMaxPPId; // The least significant bits are the type, the rest are the value. -template <typename T> inline T MakeTypedId(T value, PPIdType type) { +template <typename T> +inline T MakeTypedId(T value, PPIdType type) { return (value << kPPIdTypeBits) | static_cast<T>(type); } -template <typename T> inline bool CheckIdType(T id, PPIdType type) { +template <typename T> +inline bool CheckIdType(T id, PPIdType type) { // Say a resource of 0 is always valid, since that means "no resource." // You shouldn't be passing 0 var, instance, or module IDs around so those // are still invalid. diff --git a/ppapi/shared_impl/media_stream_buffer.h b/ppapi/shared_impl/media_stream_buffer.h index fcce7d2..8b0ebe1 100644 --- a/ppapi/shared_impl/media_stream_buffer.h +++ b/ppapi/shared_impl/media_stream_buffer.h @@ -11,11 +11,7 @@ namespace ppapi { union MediaStreamBuffer { - enum Type { - TYPE_UNKNOWN = 0, - TYPE_AUDIO = 1, - TYPE_VIDEO = 2, - }; + enum Type { TYPE_UNKNOWN = 0, TYPE_AUDIO = 1, TYPE_VIDEO = 2, }; struct Header { Type type; diff --git a/ppapi/shared_impl/media_stream_buffer_manager.cc b/ppapi/shared_impl/media_stream_buffer_manager.cc index b0588d6d..37277fc 100644 --- a/ppapi/shared_impl/media_stream_buffer_manager.cc +++ b/ppapi/shared_impl/media_stream_buffer_manager.cc @@ -12,24 +12,19 @@ namespace ppapi { MediaStreamBufferManager::Delegate::~Delegate() {} -void MediaStreamBufferManager::Delegate::OnNewBufferEnqueued() { -} +void MediaStreamBufferManager::Delegate::OnNewBufferEnqueued() {} MediaStreamBufferManager::MediaStreamBufferManager(Delegate* delegate) - : delegate_(delegate), - buffer_size_(0), - number_of_buffers_(0) { + : delegate_(delegate), buffer_size_(0), number_of_buffers_(0) { DCHECK(delegate_); } -MediaStreamBufferManager::~MediaStreamBufferManager() { -} +MediaStreamBufferManager::~MediaStreamBufferManager() {} -bool MediaStreamBufferManager::SetBuffers( - int32_t number_of_buffers, - int32_t buffer_size, - scoped_ptr<base::SharedMemory> shm, - bool enqueue_all_buffers) { +bool MediaStreamBufferManager::SetBuffers(int32_t number_of_buffers, + int32_t buffer_size, + scoped_ptr<base::SharedMemory> shm, + bool enqueue_all_buffers) { DCHECK(shm); DCHECK(!shm_); DCHECK_GT(number_of_buffers, 0); @@ -70,8 +65,7 @@ void MediaStreamBufferManager::EnqueueBuffer(int32_t index) { delegate_->OnNewBufferEnqueued(); } -MediaStreamBuffer* MediaStreamBufferManager::GetBufferPointer( - int32_t index) { +MediaStreamBuffer* MediaStreamBufferManager::GetBufferPointer(int32_t index) { DCHECK_GE(index, 0); DCHECK_LT(index, number_of_buffers_); return buffers_[index]; diff --git a/ppapi/shared_impl/media_stream_buffer_manager.h b/ppapi/shared_impl/media_stream_buffer_manager.h index b59d027..240be5d 100644 --- a/ppapi/shared_impl/media_stream_buffer_manager.h +++ b/ppapi/shared_impl/media_stream_buffer_manager.h @@ -55,9 +55,9 @@ class PPAPI_SHARED_EXPORT MediaStreamBufferManager { // Initializes shared memory for buffers transmission. bool SetBuffers(int32_t number_of_buffers, - int32_t buffer_size, - scoped_ptr<base::SharedMemory> shm, - bool enqueue_all_buffers); + int32_t buffer_size, + scoped_ptr<base::SharedMemory> shm, + bool enqueue_all_buffers); // Dequeues a buffer from |buffer_queue_|. int32_t DequeueBuffer(); diff --git a/ppapi/shared_impl/platform_file.cc b/ppapi/shared_impl/platform_file.cc index fe9c2ff..0bdd5db 100644 --- a/ppapi/shared_impl/platform_file.cc +++ b/ppapi/shared_impl/platform_file.cc @@ -14,7 +14,7 @@ base::PlatformFile IntToPlatformFile(int32_t handle) { #elif defined(OS_POSIX) return handle; #else - #error Not implemented. +#error Not implemented. #endif } @@ -24,7 +24,7 @@ int32_t PlatformFileToInt(base::PlatformFile handle) { #elif defined(OS_POSIX) return handle; #else - #error Not implemented. +#error Not implemented. #endif } diff --git a/ppapi/shared_impl/ppapi_globals.cc b/ppapi/shared_impl/ppapi_globals.cc index f652f15..3e985cf 100644 --- a/ppapi/shared_impl/ppapi_globals.cc +++ b/ppapi/shared_impl/ppapi_globals.cc @@ -36,7 +36,7 @@ PpapiGlobals::~PpapiGlobals() { ppapi_globals = NULL; } -//Static Getter for the global singleton. +// Static Getter for the global singleton. PpapiGlobals* PpapiGlobals::Get() { if (ppapi_globals) return ppapi_globals; @@ -61,16 +61,11 @@ void PpapiGlobals::ResetMainThreadMessageLoopForTesting() { main_loop_proxy_ = base::MessageLoopProxy::current(); } -bool PpapiGlobals::IsHostGlobals() const { - return false; -} +bool PpapiGlobals::IsHostGlobals() const { return false; } -bool PpapiGlobals::IsPluginGlobals() const { - return false; -} +bool PpapiGlobals::IsPluginGlobals() const { return false; } -void PpapiGlobals::MarkPluginIsActive() { -} +void PpapiGlobals::MarkPluginIsActive() {} // static PpapiGlobals* PpapiGlobals::GetThreadLocalPointer() { diff --git a/ppapi/shared_impl/ppapi_nacl_plugin_args.cc b/ppapi/shared_impl/ppapi_nacl_plugin_args.cc index 2b36aa6..92df690 100644 --- a/ppapi/shared_impl/ppapi_nacl_plugin_args.cc +++ b/ppapi/shared_impl/ppapi_nacl_plugin_args.cc @@ -9,11 +9,8 @@ namespace ppapi { // We must provide explicit definitions of these functions for builds on // Windows. PpapiNaClPluginArgs::PpapiNaClPluginArgs() - : off_the_record(false), - supports_dev_channel(false) { -} + : off_the_record(false), supports_dev_channel(false) {} -PpapiNaClPluginArgs::~PpapiNaClPluginArgs() { -} +PpapiNaClPluginArgs::~PpapiNaClPluginArgs() {} } // namespace ppapi diff --git a/ppapi/shared_impl/ppapi_permissions.cc b/ppapi/shared_impl/ppapi_permissions.cc index 7b833238..3fc6578 100644 --- a/ppapi/shared_impl/ppapi_permissions.cc +++ b/ppapi/shared_impl/ppapi_permissions.cc @@ -10,14 +10,11 @@ namespace ppapi { -PpapiPermissions::PpapiPermissions() : permissions_(0) { -} +PpapiPermissions::PpapiPermissions() : permissions_(0) {} -PpapiPermissions::PpapiPermissions(uint32 perms) : permissions_(perms) { -} +PpapiPermissions::PpapiPermissions(uint32 perms) : permissions_(perms) {} -PpapiPermissions::~PpapiPermissions() { -} +PpapiPermissions::~PpapiPermissions() {} // static PpapiPermissions PpapiPermissions::AllPermissions() { diff --git a/ppapi/shared_impl/ppapi_permissions.h b/ppapi/shared_impl/ppapi_permissions.h index 3002df6..8a12206b9 100644 --- a/ppapi/shared_impl/ppapi_permissions.h +++ b/ppapi/shared_impl/ppapi_permissions.h @@ -40,8 +40,7 @@ enum Permission { // Meta permission for initializing plugins registered on the command line // that get all permissions. - PERMISSION_ALL_BITS = PERMISSION_DEV | - PERMISSION_PRIVATE | + PERMISSION_ALL_BITS = PERMISSION_DEV | PERMISSION_PRIVATE | PERMISSION_BYPASS_USER_GESTURE | PERMISSION_TESTING | PERMISSION_FLASH | diff --git a/ppapi/shared_impl/ppapi_preferences.cc b/ppapi/shared_impl/ppapi_preferences.cc index fd2ee97..ec11a2f 100644 --- a/ppapi/shared_impl/ppapi_preferences.cc +++ b/ppapi/shared_impl/ppapi_preferences.cc @@ -12,8 +12,7 @@ Preferences::Preferences() number_of_cpu_cores(0), is_3d_supported(true), is_stage3d_supported(false), - is_stage3d_baseline_supported(false) { -} + is_stage3d_baseline_supported(false) {} Preferences::Preferences(const WebPreferences& prefs) : standard_font_family_map(prefs.standard_font_family_map), @@ -30,10 +29,8 @@ Preferences::Preferences(const WebPreferences& prefs) // and if it runs in hardware // (accelerated_compositing_for_plugins_enabled) is_webgl_supported(prefs.experimental_webgl_enabled && - prefs.accelerated_compositing_for_plugins_enabled) { -} + prefs.accelerated_compositing_for_plugins_enabled) {} -Preferences::~Preferences() { -} +Preferences::~Preferences() {} } // namespace ppapi diff --git a/ppapi/shared_impl/ppb_audio_config_shared.cc b/ppapi/shared_impl/ppb_audio_config_shared.cc index e727d17..13f1925 100644 --- a/ppapi/shared_impl/ppb_audio_config_shared.cc +++ b/ppapi/shared_impl/ppb_audio_config_shared.cc @@ -21,17 +21,14 @@ PPB_AudioConfig_Shared::PPB_AudioConfig_Shared(ResourceObjectType type, PP_Instance instance) : Resource(type, instance), sample_rate_(PP_AUDIOSAMPLERATE_NONE), - sample_frame_count_(0) { -} + sample_frame_count_(0) {} -PPB_AudioConfig_Shared::~PPB_AudioConfig_Shared() { -} +PPB_AudioConfig_Shared::~PPB_AudioConfig_Shared() {} -PP_Resource PPB_AudioConfig_Shared::Create( - ResourceObjectType type, - PP_Instance instance, - PP_AudioSampleRate sample_rate, - uint32_t sample_frame_count) { +PP_Resource PPB_AudioConfig_Shared::Create(ResourceObjectType type, + PP_Instance instance, + PP_AudioSampleRate sample_rate, + uint32_t sample_frame_count) { scoped_refptr<PPB_AudioConfig_Shared> object( new PPB_AudioConfig_Shared(type, instance)); if (!object->Init(sample_rate, sample_frame_count)) @@ -97,8 +94,8 @@ uint32_t PPB_AudioConfig_Shared::RecommendSampleFrameCount_1_1( // If client is using same sample rate as audio hardware, then recommend a // multiple of the audio hardware's sample frame count. if (!kHighLatencyDevice && hardware_sample_rate == sample_rate) { - return CalculateMultipleOfSampleFrameCount( - hardware_sample_frame_count, sample_frame_count); + return CalculateMultipleOfSampleFrameCount(hardware_sample_frame_count, + sample_frame_count); } // If the hardware requires a high latency buffer or we're at a low sample @@ -126,12 +123,12 @@ uint32_t PPB_AudioConfig_Shared::RecommendSampleFrameCount_1_1( int min_sample_frame_count = kLowLatencySampleFrameCount; if (hardware_sample_rate == 44100 && sample_rate == 48000 && hardware_sample_frame_count > hardware_sample_rate / 100u) { - min_sample_frame_count = std::max( - 2 * kLowLatencySampleFrameCount, hardware_sample_frame_count); + min_sample_frame_count = + std::max(2 * kLowLatencySampleFrameCount, hardware_sample_frame_count); } - return CalculateMultipleOfSampleFrameCount( - min_sample_frame_count, sample_frame_count); + return CalculateMultipleOfSampleFrameCount(min_sample_frame_count, + sample_frame_count); } // static @@ -141,7 +138,7 @@ PP_AudioSampleRate PPB_AudioConfig_Shared::RecommendSampleRate( if (enter.failed()) return PP_AUDIOSAMPLERATE_NONE; PP_AudioSampleRate hardware_sample_rate = static_cast<PP_AudioSampleRate>( - enter.functions()->GetAudioHardwareOutputSampleRate(instance)); + enter.functions()->GetAudioHardwareOutputSampleRate(instance)); return hardware_sample_rate; } diff --git a/ppapi/shared_impl/ppb_audio_config_shared.h b/ppapi/shared_impl/ppb_audio_config_shared.h index edc84ba..5aca24a 100644 --- a/ppapi/shared_impl/ppb_audio_config_shared.h +++ b/ppapi/shared_impl/ppb_audio_config_shared.h @@ -30,9 +30,11 @@ class PPAPI_SHARED_EXPORT PPB_AudioConfig_Shared PP_Instance instance, PP_AudioSampleRate sample_rate, uint32_t sample_frame_count); - static uint32_t RecommendSampleFrameCount_1_0(PP_AudioSampleRate sample_rate, + static uint32_t RecommendSampleFrameCount_1_0( + PP_AudioSampleRate sample_rate, uint32_t request_sample_frame_count); - static uint32_t RecommendSampleFrameCount_1_1(PP_Instance instance, + static uint32_t RecommendSampleFrameCount_1_1( + PP_Instance instance, PP_AudioSampleRate sample_rate, uint32_t request_sample_frame_count); static PP_AudioSampleRate RecommendSampleRate(PP_Instance); diff --git a/ppapi/shared_impl/ppb_audio_shared.cc b/ppapi/shared_impl/ppb_audio_shared.cc index 1b12d5c5..ced1146 100644 --- a/ppapi/shared_impl/ppb_audio_shared.cc +++ b/ppapi/shared_impl/ppb_audio_shared.cc @@ -18,23 +18,17 @@ PP_ThreadFunctions thread_functions; } #endif // defined(OS_NACL) -AudioCallbackCombined::AudioCallbackCombined() : callback_1_0_(NULL), - callback_(NULL) { -} +AudioCallbackCombined::AudioCallbackCombined() + : callback_1_0_(NULL), callback_(NULL) {} AudioCallbackCombined::AudioCallbackCombined( PPB_Audio_Callback_1_0 callback_1_0) - : callback_1_0_(callback_1_0), - callback_(NULL) { -} + : callback_1_0_(callback_1_0), callback_(NULL) {} AudioCallbackCombined::AudioCallbackCombined(PPB_Audio_Callback callback) - : callback_1_0_(NULL), - callback_(callback) { -} + : callback_1_0_(NULL), callback_(callback) {} -AudioCallbackCombined::~AudioCallbackCombined() { -} +AudioCallbackCombined::~AudioCallbackCombined() {} bool AudioCallbackCombined::IsValid() const { return callback_1_0_ || callback_; @@ -111,8 +105,8 @@ void PPB_Audio_Shared::SetStreamInfo( socket_.reset(new base::CancelableSyncSocket(socket_handle)); shared_memory_.reset(new base::SharedMemory(shared_memory_handle, false)); shared_memory_size_ = shared_memory_size; - bytes_per_second_ = kAudioOutputChannels * (kBitsPerAudioOutputSample / 8) * - sample_rate; + bytes_per_second_ = + kAudioOutputChannels * (kBitsPerAudioOutputSample / 8) * sample_rate; buffer_index_ = 0; if (!shared_memory_->Map(shared_memory_size_)) { @@ -125,9 +119,8 @@ void PPB_Audio_Shared::SetStreamInfo( audio_bus_ = media::AudioBus::WrapMemory( kAudioOutputChannels, sample_frame_count, shared_memory_->memory()); // Setup integer audio buffer for user audio data. - client_buffer_size_bytes_ = - audio_bus_->frames() * audio_bus_->channels() * - kBitsPerAudioOutputSample / 8; + client_buffer_size_bytes_ = audio_bus_->frames() * audio_bus_->channels() * + kBitsPerAudioOutputSample / 8; client_buffer_.reset(new uint8_t[client_buffer_size_bytes_]); } @@ -147,8 +140,8 @@ void PPB_Audio_Shared::StartThread() { memset(client_buffer_.get(), 0, client_buffer_size_bytes_); #if !defined(OS_NACL) DCHECK(!audio_thread_.get()); - audio_thread_.reset(new base::DelegateSimpleThread( - this, "plugin_audio_thread")); + audio_thread_.reset( + new base::DelegateSimpleThread(this, "plugin_audio_thread")); audio_thread_->Start(); #else // Use NaCl's special API for IRT code that creates threads that call back @@ -214,13 +207,13 @@ void PPB_Audio_Shared::Run() { PP_TimeDelta latency = static_cast<double>(pending_data) / bytes_per_second_; - callback_.Run(client_buffer_.get(), client_buffer_size_bytes_, latency, - user_data_); + callback_.Run( + client_buffer_.get(), client_buffer_size_bytes_, latency, user_data_); // Deinterleave the audio data into the shared memory as floats. - audio_bus_->FromInterleaved( - client_buffer_.get(), audio_bus_->frames(), - kBitsPerAudioOutputSample / 8); + audio_bus_->FromInterleaved(client_buffer_.get(), + audio_bus_->frames(), + kBitsPerAudioOutputSample / 8); // Let the other end know which buffer we just filled. The buffer index is // used to ensure the other end is getting the buffer it expects. For more diff --git a/ppapi/shared_impl/ppb_crypto_shared.cc b/ppapi/shared_impl/ppb_crypto_shared.cc index 02b5051..f172ea7 100644 --- a/ppapi/shared_impl/ppb_crypto_shared.cc +++ b/ppapi/shared_impl/ppb_crypto_shared.cc @@ -19,9 +19,7 @@ void GetRandomBytes(char* buffer, uint32_t num_bytes) { base::RandBytes(buffer, num_bytes); } -const PPB_Crypto_Dev crypto_interface = { - &GetRandomBytes -}; +const PPB_Crypto_Dev crypto_interface = {&GetRandomBytes}; } // namespace diff --git a/ppapi/shared_impl/ppb_device_ref_shared.cc b/ppapi/shared_impl/ppb_device_ref_shared.cc index 1b45873..81d8878 100644 --- a/ppapi/shared_impl/ppb_device_ref_shared.cc +++ b/ppapi/shared_impl/ppb_device_ref_shared.cc @@ -13,28 +13,20 @@ using ppapi::thunk::PPB_DeviceRef_API; namespace ppapi { -DeviceRefData::DeviceRefData() - : type(PP_DEVICETYPE_DEV_INVALID) { -} +DeviceRefData::DeviceRefData() : type(PP_DEVICETYPE_DEV_INVALID) {} PPB_DeviceRef_Shared::PPB_DeviceRef_Shared(ResourceObjectType type, PP_Instance instance, const DeviceRefData& data) - : Resource(type, instance), - data_(data) { -} + : Resource(type, instance), data_(data) {} -PPB_DeviceRef_API* PPB_DeviceRef_Shared::AsPPB_DeviceRef_API() { - return this; -} +PPB_DeviceRef_API* PPB_DeviceRef_Shared::AsPPB_DeviceRef_API() { return this; } const DeviceRefData& PPB_DeviceRef_Shared::GetDeviceRefData() const { return data_; } -PP_DeviceType_Dev PPB_DeviceRef_Shared::GetType() { - return data_.type; -} +PP_DeviceType_Dev PPB_DeviceRef_Shared::GetType() { return data_.type; } PP_Var PPB_DeviceRef_Shared::GetName() { return StringVar::StringToPPVar(data_.name); diff --git a/ppapi/shared_impl/ppb_device_ref_shared.h b/ppapi/shared_impl/ppb_device_ref_shared.h index 792eb45..294093f 100644 --- a/ppapi/shared_impl/ppb_device_ref_shared.h +++ b/ppapi/shared_impl/ppb_device_ref_shared.h @@ -21,9 +21,7 @@ struct PPAPI_SHARED_EXPORT DeviceRefData { DeviceRefData(); bool operator==(const DeviceRefData& other) const { - return type == other.type && - name == other.name && - id == other.id; + return type == other.type && name == other.name && id == other.id; } PP_DeviceType_Dev type; diff --git a/ppapi/shared_impl/ppb_gamepad_shared.cc b/ppapi/shared_impl/ppb_gamepad_shared.cc index 41c7668..4f83b39 100644 --- a/ppapi/shared_impl/ppb_gamepad_shared.cc +++ b/ppapi/shared_impl/ppb_gamepad_shared.cc @@ -27,9 +27,8 @@ void ConvertWebKitGamepadData(const WebKitGamepads& webkit_data, output_pad.axes_length = webkit_pad.axes_length; memcpy(output_pad.axes, webkit_pad.axes, sizeof(output_pad.axes)); output_pad.buttons_length = webkit_pad.buttons_length; - memcpy(output_pad.buttons, - webkit_pad.buttons, - sizeof(output_pad.buttons)); + memcpy( + output_pad.buttons, webkit_pad.buttons, sizeof(output_pad.buttons)); } } } diff --git a/ppapi/shared_impl/ppb_gamepad_shared.h b/ppapi/shared_impl/ppb_gamepad_shared.h index 821980f..7bc1e61 100644 --- a/ppapi/shared_impl/ppb_gamepad_shared.h +++ b/ppapi/shared_impl/ppb_gamepad_shared.h @@ -20,43 +20,43 @@ namespace ppapi { // This must match the definition of blink::Gamepad. The GamepadHost unit test // has some compile asserts to validate this. struct WebKitGamepad { - static const size_t kIdLengthCap = 128; - static const size_t kAxesLengthCap = 16; - static const size_t kButtonsLengthCap = 32; + static const size_t kIdLengthCap = 128; + static const size_t kAxesLengthCap = 16; + static const size_t kButtonsLengthCap = 32; - // Is there a gamepad connected at this index? - bool connected; + // Is there a gamepad connected at this index? + bool connected; - // Device identifier (based on manufacturer, model, etc.). - base::char16 id[kIdLengthCap]; + // Device identifier (based on manufacturer, model, etc.). + base::char16 id[kIdLengthCap]; - // Monotonically increasing value referring to when the data were last - // updated. - unsigned long long timestamp; + // Monotonically increasing value referring to when the data were last + // updated. + unsigned long long timestamp; - // Number of valid entries in the axes array. - unsigned axes_length; + // Number of valid entries in the axes array. + unsigned axes_length; - // Normalized values representing axes, in the range [-1..1]. - float axes[kAxesLengthCap]; + // Normalized values representing axes, in the range [-1..1]. + float axes[kAxesLengthCap]; - // Number of valid entries in the buttons array. - unsigned buttons_length; + // Number of valid entries in the buttons array. + unsigned buttons_length; - // Normalized values representing buttons, in the range [0..1]. - float buttons[kButtonsLengthCap]; + // Normalized values representing buttons, in the range [0..1]. + float buttons[kButtonsLengthCap]; }; // This must match the definition of blink::Gamepads. The GamepadHost unit // test has some compile asserts to validate this. struct WebKitGamepads { - static const size_t kItemsLengthCap = 4; + static const size_t kItemsLengthCap = 4; - // Number of valid entries in the items array. - unsigned length; + // Number of valid entries in the items array. + unsigned length; - // Gamepad data for N separate gamepad devices. - WebKitGamepad items[kItemsLengthCap]; + // Gamepad data for N separate gamepad devices. + WebKitGamepad items[kItemsLengthCap]; }; // This is the structure store in shared memory. It must match diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.cc b/ppapi/shared_impl/ppb_graphics_3d_shared.cc index be8ee76..74076ba 100644 --- a/ppapi/shared_impl/ppb_graphics_3d_shared.cc +++ b/ppapi/shared_impl/ppb_graphics_3d_shared.cc @@ -13,12 +13,10 @@ namespace ppapi { PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(PP_Instance instance) - : Resource(OBJECT_IS_IMPL, instance) { -} + : Resource(OBJECT_IS_IMPL, instance) {} PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(const HostResource& host_resource) - : Resource(OBJECT_IS_PROXY, host_resource) { -} + : Resource(OBJECT_IS_PROXY, host_resource) {} PPB_Graphics3D_Shared::~PPB_Graphics3D_Shared() { // Make sure that GLES2 implementation has already been destroyed. @@ -58,8 +56,9 @@ int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { int32_t PPB_Graphics3D_Shared::SwapBuffers( scoped_refptr<TrackedCallback> callback) { if (HasPendingSwap()) { - Log(PP_LOGLEVEL_ERROR, "PPB_Graphics3D.SwapBuffers: Plugin attempted swap " - "with previous swap still pending."); + Log(PP_LOGLEVEL_ERROR, + "PPB_Graphics3D.SwapBuffers: Plugin attempted swap " + "with previous swap still pending."); // Already a pending SwapBuffers that hasn't returned yet. return PP_ERROR_INPROGRESS; } @@ -131,10 +130,10 @@ bool PPB_Graphics3D_Shared::CreateGLES2Impl( GetGpuControl())); if (!gles2_impl_->Initialize( - transfer_buffer_size, - kMinTransferBufferSize, - std::max(kMaxTransferBufferSize, transfer_buffer_size), - gpu::gles2::GLES2Implementation::kNoLimit)) { + transfer_buffer_size, + kMinTransferBufferSize, + std::max(kMaxTransferBufferSize, transfer_buffer_size), + gpu::gles2::GLES2Implementation::kNoLimit)) { return false; } @@ -150,4 +149,3 @@ void PPB_Graphics3D_Shared::DestroyGLES2Impl() { } } // namespace ppapi - diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.h b/ppapi/shared_impl/ppb_graphics_3d_shared.h index d576d57..116a8c4 100644 --- a/ppapi/shared_impl/ppb_graphics_3d_shared.h +++ b/ppapi/shared_impl/ppb_graphics_3d_shared.h @@ -51,9 +51,7 @@ class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared GLenum access) OVERRIDE; virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE; - gpu::gles2::GLES2Implementation* gles2_impl() { - return gles2_impl_.get(); - } + gpu::gles2::GLES2Implementation* gles2_impl() { return gles2_impl_.get(); } // Sends swap-buffers notification to the plugin. void SwapBuffersACK(int32_t pp_error); @@ -87,4 +85,3 @@ class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared } // namespace ppapi #endif // PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ - diff --git a/ppapi/shared_impl/ppb_image_data_shared.cc b/ppapi/shared_impl/ppb_image_data_shared.cc index 3900c92..2dfbabd 100644 --- a/ppapi/shared_impl/ppb_image_data_shared.cc +++ b/ppapi/shared_impl/ppb_image_data_shared.cc @@ -31,7 +31,7 @@ PP_ImageDataFormat PPB_ImageData_Shared::GetNativeImageDataFormat() { else if (SK_R32_SHIFT == 0) return PP_IMAGEDATAFORMAT_RGBA_PREMUL; else - return PP_IMAGEDATAFORMAT_BGRA_PREMUL; // Default to something on failure + return PP_IMAGEDATAFORMAT_BGRA_PREMUL; // Default to something on failure #endif } @@ -46,8 +46,7 @@ PP_Bool PPB_ImageData_Shared::IsImageDataFormatSupported( PP_Bool PPB_ImageData_Shared::IsImageDataDescValid( const PP_ImageDataDesc& desc) { return PP_FromBool(IsImageDataFormatSupported(desc.format) && - desc.size.width > 0 && - desc.size.height > 0 && + desc.size.width > 0 && desc.size.height > 0 && desc.stride > 0); } diff --git a/ppapi/shared_impl/ppb_input_event_shared.cc b/ppapi/shared_impl/ppb_input_event_shared.cc index 88b9793..3443759 100644 --- a/ppapi/shared_impl/ppb_input_event_shared.cc +++ b/ppapi/shared_impl/ppb_input_event_shared.cc @@ -30,18 +30,14 @@ InputEventData::InputEventData() composition_selection_end(0), touches(), changed_touches(), - target_touches() { -} + target_touches() {} -InputEventData::~InputEventData() { -} +InputEventData::~InputEventData() {} PPB_InputEvent_Shared::PPB_InputEvent_Shared(ResourceObjectType type, PP_Instance instance, const InputEventData& data) - : Resource(type, instance), - data_(data) { -} + : Resource(type, instance), data_(data) {} PPB_InputEvent_API* PPB_InputEvent_Shared::AsPPB_InputEvent_API() { return this; @@ -51,17 +47,13 @@ const InputEventData& PPB_InputEvent_Shared::GetInputEventData() const { return data_; } -PP_InputEvent_Type PPB_InputEvent_Shared::GetType() { - return data_.event_type; -} +PP_InputEvent_Type PPB_InputEvent_Shared::GetType() { return data_.event_type; } PP_TimeTicks PPB_InputEvent_Shared::GetTimeStamp() { return data_.event_time_stamp; } -uint32_t PPB_InputEvent_Shared::GetModifiers() { - return data_.event_modifiers; -} +uint32_t PPB_InputEvent_Shared::GetModifiers() { return data_.event_modifiers; } PP_InputEvent_MouseButton PPB_InputEvent_Shared::GetMouseButton() { return data_.mouse_button; @@ -91,9 +83,7 @@ PP_Bool PPB_InputEvent_Shared::GetWheelScrollByPage() { return PP_FromBool(data_.wheel_scroll_by_page); } -uint32_t PPB_InputEvent_Shared::GetKeyCode() { - return data_.key_code; -} +uint32_t PPB_InputEvent_Shared::GetKeyCode() { return data_.key_code; } PP_Var PPB_InputEvent_Shared::GetCharacterText() { return StringVar::StringToPPVar(data_.character_text); @@ -201,7 +191,7 @@ PP_TouchPoint PPB_InputEvent_Shared::GetTouchById(PP_TouchListType list, return PP_MakeTouchPoint(); } -//static +// static PP_Resource PPB_InputEvent_Shared::CreateIMEInputEvent( ResourceObjectType type, PP_Instance instance, @@ -239,7 +229,7 @@ PP_Resource PPB_InputEvent_Shared::CreateIMEInputEvent( return (new PPB_InputEvent_Shared(type, instance, data))->GetReference(); } -//static +// static PP_Resource PPB_InputEvent_Shared::CreateKeyboardInputEvent( ResourceObjectType type, PP_Instance instance, @@ -276,7 +266,7 @@ PP_Resource PPB_InputEvent_Shared::CreateKeyboardInputEvent( return (new PPB_InputEvent_Shared(type, instance, data))->GetReference(); } -//static +// static PP_Resource PPB_InputEvent_Shared::CreateMouseInputEvent( ResourceObjectType type, PP_Instance instance, @@ -306,7 +296,7 @@ PP_Resource PPB_InputEvent_Shared::CreateMouseInputEvent( return (new PPB_InputEvent_Shared(type, instance, data))->GetReference(); } -//static +// static PP_Resource PPB_InputEvent_Shared::CreateWheelInputEvent( ResourceObjectType type, PP_Instance instance, diff --git a/ppapi/shared_impl/ppb_instance_shared.cc b/ppapi/shared_impl/ppb_instance_shared.cc index 18033fc..49b865a 100644 --- a/ppapi/shared_impl/ppb_instance_shared.cc +++ b/ppapi/shared_impl/ppb_instance_shared.cc @@ -21,8 +21,7 @@ namespace ppapi { // static const int PPB_Instance_Shared::kExtraCharsForTextInput = 100; -PPB_Instance_Shared::~PPB_Instance_Shared() { -} +PPB_Instance_Shared::~PPB_Instance_Shared() {} void PPB_Instance_Shared::Log(PP_Instance instance, PP_LogLevel level, @@ -48,12 +47,11 @@ int32_t PPB_Instance_Shared::ValidateRequestInputEvents( bool is_filtering, uint32_t event_classes) { // See if any bits are set we don't know about. - if (event_classes & - ~static_cast<uint32_t>(PP_INPUTEVENT_CLASS_MOUSE | - PP_INPUTEVENT_CLASS_KEYBOARD | - PP_INPUTEVENT_CLASS_WHEEL | - PP_INPUTEVENT_CLASS_TOUCH | - PP_INPUTEVENT_CLASS_IME)) + if (event_classes & ~static_cast<uint32_t>(PP_INPUTEVENT_CLASS_MOUSE | + PP_INPUTEVENT_CLASS_KEYBOARD | + PP_INPUTEVENT_CLASS_WHEEL | + PP_INPUTEVENT_CLASS_TOUCH | + PP_INPUTEVENT_CLASS_IME)) return PP_ERROR_NOTSUPPORTED; // Everything else is valid. @@ -94,8 +92,8 @@ bool PPB_Instance_Shared::ValidateSetCursorParams(PP_MouseCursor_Type type, return false; // Validate the hot spot location. - if (hot_spot->x < 0 || hot_spot->x >= desc.size.width || - hot_spot->y < 0 || hot_spot->y >= desc.size.height) + if (hot_spot->x < 0 || hot_spot->x >= desc.size.width || hot_spot->y < 0 || + hot_spot->y >= desc.size.height) return false; return true; } diff --git a/ppapi/shared_impl/ppb_memory_shared.cc b/ppapi/shared_impl/ppb_memory_shared.cc index 57d52f0..aaf5f36 100644 --- a/ppapi/shared_impl/ppb_memory_shared.cc +++ b/ppapi/shared_impl/ppb_memory_shared.cc @@ -16,18 +16,11 @@ namespace ppapi { namespace { -void* MemAlloc(uint32_t num_bytes) { - return malloc(num_bytes); -} +void* MemAlloc(uint32_t num_bytes) { return malloc(num_bytes); } -void MemFree(void* ptr) { - free(ptr); -} +void MemFree(void* ptr) { free(ptr); } -const PPB_Memory_Dev ppb_memory = { - &MemAlloc, - &MemFree -}; +const PPB_Memory_Dev ppb_memory = {&MemAlloc, &MemFree}; } // namespace diff --git a/ppapi/shared_impl/ppb_message_loop_shared.cc b/ppapi/shared_impl/ppb_message_loop_shared.cc index 9c0c92d..3ca7239 100644 --- a/ppapi/shared_impl/ppb_message_loop_shared.cc +++ b/ppapi/shared_impl/ppb_message_loop_shared.cc @@ -7,14 +7,11 @@ namespace ppapi { MessageLoopShared::MessageLoopShared(PP_Instance instance) - : Resource(OBJECT_IS_PROXY, instance) { -} + : Resource(OBJECT_IS_PROXY, instance) {} MessageLoopShared::MessageLoopShared(ForMainThread) - : Resource(Resource::Untracked()) { -} + : Resource(Resource::Untracked()) {} -MessageLoopShared::~MessageLoopShared() { -} +MessageLoopShared::~MessageLoopShared() {} } // namespace ppapi diff --git a/ppapi/shared_impl/ppb_opengles2_shared.cc b/ppapi/shared_impl/ppb_opengles2_shared.cc index 3944089..66af5d2 100644 --- a/ppapi/shared_impl/ppb_opengles2_shared.cc +++ b/ppapi/shared_impl/ppb_opengles2_shared.cc @@ -39,8 +39,10 @@ void AttachShader(PP_Resource context_id, GLuint program, GLuint shader) { } } -void BindAttribLocation( - PP_Resource context_id, GLuint program, GLuint index, const char* name) { +void BindAttribLocation(PP_Resource context_id, + GLuint program, + GLuint index, + const char* name) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->BindAttribLocation(program, index, name); @@ -54,16 +56,18 @@ void BindBuffer(PP_Resource context_id, GLenum target, GLuint buffer) { } } -void BindFramebuffer( - PP_Resource context_id, GLenum target, GLuint framebuffer) { +void BindFramebuffer(PP_Resource context_id, + GLenum target, + GLuint framebuffer) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->BindFramebuffer(target, framebuffer); } } -void BindRenderbuffer( - PP_Resource context_id, GLenum target, GLuint renderbuffer) { +void BindRenderbuffer(PP_Resource context_id, + GLenum target, + GLuint renderbuffer) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->BindRenderbuffer(target, renderbuffer); @@ -77,9 +81,11 @@ void BindTexture(PP_Resource context_id, GLenum target, GLuint texture) { } } -void BlendColor( - PP_Resource context_id, GLclampf red, GLclampf green, GLclampf blue, - GLclampf alpha) { +void BlendColor(PP_Resource context_id, + GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->BlendColor(red, green, blue, alpha); @@ -93,8 +99,9 @@ void BlendEquation(PP_Resource context_id, GLenum mode) { } } -void BlendEquationSeparate( - PP_Resource context_id, GLenum modeRGB, GLenum modeAlpha) { +void BlendEquationSeparate(PP_Resource context_id, + GLenum modeRGB, + GLenum modeAlpha) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->BlendEquationSeparate(modeRGB, modeAlpha); @@ -108,27 +115,33 @@ void BlendFunc(PP_Resource context_id, GLenum sfactor, GLenum dfactor) { } } -void BlendFuncSeparate( - PP_Resource context_id, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, - GLenum dstAlpha) { +void BlendFuncSeparate(PP_Resource context_id, + GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); } } -void BufferData( - PP_Resource context_id, GLenum target, GLsizeiptr size, const void* data, - GLenum usage) { +void BufferData(PP_Resource context_id, + GLenum target, + GLsizeiptr size, + const void* data, + GLenum usage) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->BufferData(target, size, data, usage); } } -void BufferSubData( - PP_Resource context_id, GLenum target, GLintptr offset, GLsizeiptr size, - const void* data) { +void BufferSubData(PP_Resource context_id, + GLenum target, + GLintptr offset, + GLsizeiptr size, + const void* data) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->BufferSubData(target, offset, size, data); @@ -151,9 +164,11 @@ void Clear(PP_Resource context_id, GLbitfield mask) { } } -void ClearColor( - PP_Resource context_id, GLclampf red, GLclampf green, GLclampf blue, - GLclampf alpha) { +void ClearColor(PP_Resource context_id, + GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->ClearColor(red, green, blue, alpha); @@ -174,9 +189,11 @@ void ClearStencil(PP_Resource context_id, GLint s) { } } -void ColorMask( - PP_Resource context_id, GLboolean red, GLboolean green, GLboolean blue, - GLboolean alpha) { +void ColorMask(PP_Resource context_id, + GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->ColorMask(red, green, blue, alpha); @@ -190,51 +207,75 @@ void CompileShader(PP_Resource context_id, GLuint shader) { } } -void CompressedTexImage2D( - PP_Resource context_id, GLenum target, GLint level, GLenum internalformat, - GLsizei width, GLsizei height, GLint border, GLsizei imageSize, - const void* data) { +void CompressedTexImage2D(PP_Resource context_id, + GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const void* data) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->CompressedTexImage2D( - target, level, internalformat, width, height, border, imageSize, - data); + ToGles2Impl(&enter)->CompressedTexImage2D( + target, level, internalformat, width, height, border, imageSize, data); } } -void CompressedTexSubImage2D( - PP_Resource context_id, GLenum target, GLint level, GLint xoffset, - GLint yoffset, GLsizei width, GLsizei height, GLenum format, - GLsizei imageSize, const void* data) { +void CompressedTexSubImage2D(PP_Resource context_id, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const void* data) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->CompressedTexSubImage2D( - target, level, xoffset, yoffset, width, height, format, imageSize, - data); + ToGles2Impl(&enter)->CompressedTexSubImage2D(target, + level, + xoffset, + yoffset, + width, + height, + format, + imageSize, + data); } } -void CopyTexImage2D( - PP_Resource context_id, GLenum target, GLint level, GLenum internalformat, - GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { +void CopyTexImage2D(PP_Resource context_id, + GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->CopyTexImage2D( - target, level, internalformat, x, y, width, height, border); + ToGles2Impl(&enter)->CopyTexImage2D( + target, level, internalformat, x, y, width, height, border); } } -void CopyTexSubImage2D( - PP_Resource context_id, GLenum target, GLint level, GLint xoffset, - GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { +void CopyTexSubImage2D(PP_Resource context_id, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->CopyTexSubImage2D( - target, level, xoffset, yoffset, x, y, width, height); + ToGles2Impl(&enter)->CopyTexSubImage2D( + target, level, xoffset, yoffset, x, y, width, height); } } @@ -270,8 +311,9 @@ void DeleteBuffers(PP_Resource context_id, GLsizei n, const GLuint* buffers) { } } -void DeleteFramebuffers( - PP_Resource context_id, GLsizei n, const GLuint* framebuffers) { +void DeleteFramebuffers(PP_Resource context_id, + GLsizei n, + const GLuint* framebuffers) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->DeleteFramebuffers(n, framebuffers); @@ -285,8 +327,9 @@ void DeleteProgram(PP_Resource context_id, GLuint program) { } } -void DeleteRenderbuffers( - PP_Resource context_id, GLsizei n, const GLuint* renderbuffers) { +void DeleteRenderbuffers(PP_Resource context_id, + GLsizei n, + const GLuint* renderbuffers) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->DeleteRenderbuffers(n, renderbuffers); @@ -300,8 +343,7 @@ void DeleteShader(PP_Resource context_id, GLuint shader) { } } -void DeleteTextures( - PP_Resource context_id, GLsizei n, const GLuint* textures) { +void DeleteTextures(PP_Resource context_id, GLsizei n, const GLuint* textures) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->DeleteTextures(n, textures); @@ -350,17 +392,21 @@ void DisableVertexAttribArray(PP_Resource context_id, GLuint index) { } } -void DrawArrays( - PP_Resource context_id, GLenum mode, GLint first, GLsizei count) { +void DrawArrays(PP_Resource context_id, + GLenum mode, + GLint first, + GLsizei count) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->DrawArrays(mode, first, count); } } -void DrawElements( - PP_Resource context_id, GLenum mode, GLsizei count, GLenum type, - const void* indices) { +void DrawElements(PP_Resource context_id, + GLenum mode, + GLsizei count, + GLenum type, + const void* indices) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->DrawElements(mode, count, type, indices); @@ -395,25 +441,28 @@ void Flush(PP_Resource context_id) { } } -void FramebufferRenderbuffer( - PP_Resource context_id, GLenum target, GLenum attachment, - GLenum renderbuffertarget, GLuint renderbuffer) { +void FramebufferRenderbuffer(PP_Resource context_id, + GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->FramebufferRenderbuffer( - target, attachment, renderbuffertarget, renderbuffer); + ToGles2Impl(&enter)->FramebufferRenderbuffer( + target, attachment, renderbuffertarget, renderbuffer); } } -void FramebufferTexture2D( - PP_Resource context_id, GLenum target, GLenum attachment, GLenum textarget, - GLuint texture, GLint level) { +void FramebufferTexture2D(PP_Resource context_id, + GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->FramebufferTexture2D( - target, attachment, textarget, texture, level); + ToGles2Impl(&enter) + ->FramebufferTexture2D(target, attachment, textarget, texture, level); } } @@ -445,8 +494,9 @@ void GenFramebuffers(PP_Resource context_id, GLsizei n, GLuint* framebuffers) { } } -void GenRenderbuffers( - PP_Resource context_id, GLsizei n, GLuint* renderbuffers) { +void GenRenderbuffers(PP_Resource context_id, + GLsizei n, + GLuint* renderbuffers) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GenRenderbuffers(n, renderbuffers); @@ -460,39 +510,50 @@ void GenTextures(PP_Resource context_id, GLsizei n, GLuint* textures) { } } -void GetActiveAttrib( - PP_Resource context_id, GLuint program, GLuint index, GLsizei bufsize, - GLsizei* length, GLint* size, GLenum* type, char* name) { +void GetActiveAttrib(PP_Resource context_id, + GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->GetActiveAttrib( - program, index, bufsize, length, size, type, name); + ToGles2Impl(&enter) + ->GetActiveAttrib(program, index, bufsize, length, size, type, name); } } -void GetActiveUniform( - PP_Resource context_id, GLuint program, GLuint index, GLsizei bufsize, - GLsizei* length, GLint* size, GLenum* type, char* name) { +void GetActiveUniform(PP_Resource context_id, + GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->GetActiveUniform( - program, index, bufsize, length, size, type, name); + ToGles2Impl(&enter) + ->GetActiveUniform(program, index, bufsize, length, size, type, name); } } -void GetAttachedShaders( - PP_Resource context_id, GLuint program, GLsizei maxcount, GLsizei* count, - GLuint* shaders) { +void GetAttachedShaders(PP_Resource context_id, + GLuint program, + GLsizei maxcount, + GLsizei* count, + GLuint* shaders) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetAttachedShaders(program, maxcount, count, shaders); } } -GLint GetAttribLocation( - PP_Resource context_id, GLuint program, const char* name) { +GLint GetAttribLocation(PP_Resource context_id, + GLuint program, + const char* name) { Enter3D enter(context_id, true); if (enter.succeeded()) { return ToGles2Impl(&enter)->GetAttribLocation(program, name); @@ -508,8 +569,10 @@ void GetBooleanv(PP_Resource context_id, GLenum pname, GLboolean* params) { } } -void GetBufferParameteriv( - PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { +void GetBufferParameteriv(PP_Resource context_id, + GLenum target, + GLenum pname, + GLint* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetBufferParameteriv(target, pname, params); @@ -532,14 +595,15 @@ void GetFloatv(PP_Resource context_id, GLenum pname, GLfloat* params) { } } -void GetFramebufferAttachmentParameteriv( - PP_Resource context_id, GLenum target, GLenum attachment, GLenum pname, - GLint* params) { +void GetFramebufferAttachmentParameteriv(PP_Resource context_id, + GLenum target, + GLenum attachment, + GLenum pname, + GLint* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->GetFramebufferAttachmentParameteriv( - target, attachment, pname, params); + ToGles2Impl(&enter)->GetFramebufferAttachmentParameteriv( + target, attachment, pname, params); } } @@ -550,62 +614,75 @@ void GetIntegerv(PP_Resource context_id, GLenum pname, GLint* params) { } } -void GetProgramiv( - PP_Resource context_id, GLuint program, GLenum pname, GLint* params) { +void GetProgramiv(PP_Resource context_id, + GLuint program, + GLenum pname, + GLint* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetProgramiv(program, pname, params); } } -void GetProgramInfoLog( - PP_Resource context_id, GLuint program, GLsizei bufsize, GLsizei* length, - char* infolog) { +void GetProgramInfoLog(PP_Resource context_id, + GLuint program, + GLsizei bufsize, + GLsizei* length, + char* infolog) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetProgramInfoLog(program, bufsize, length, infolog); } } -void GetRenderbufferParameteriv( - PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { +void GetRenderbufferParameteriv(PP_Resource context_id, + GLenum target, + GLenum pname, + GLint* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetRenderbufferParameteriv(target, pname, params); } } -void GetShaderiv( - PP_Resource context_id, GLuint shader, GLenum pname, GLint* params) { +void GetShaderiv(PP_Resource context_id, + GLuint shader, + GLenum pname, + GLint* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetShaderiv(shader, pname, params); } } -void GetShaderInfoLog( - PP_Resource context_id, GLuint shader, GLsizei bufsize, GLsizei* length, - char* infolog) { +void GetShaderInfoLog(PP_Resource context_id, + GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* infolog) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetShaderInfoLog(shader, bufsize, length, infolog); } } -void GetShaderPrecisionFormat( - PP_Resource context_id, GLenum shadertype, GLenum precisiontype, - GLint* range, GLint* precision) { +void GetShaderPrecisionFormat(PP_Resource context_id, + GLenum shadertype, + GLenum precisiontype, + GLint* range, + GLint* precision) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->GetShaderPrecisionFormat( - shadertype, precisiontype, range, precision); + ToGles2Impl(&enter) + ->GetShaderPrecisionFormat(shadertype, precisiontype, range, precision); } } -void GetShaderSource( - PP_Resource context_id, GLuint shader, GLsizei bufsize, GLsizei* length, - char* source) { +void GetShaderSource(PP_Resource context_id, + GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetShaderSource(shader, bufsize, length, source); @@ -621,40 +698,49 @@ const GLubyte* GetString(PP_Resource context_id, GLenum name) { } } -void GetTexParameterfv( - PP_Resource context_id, GLenum target, GLenum pname, GLfloat* params) { +void GetTexParameterfv(PP_Resource context_id, + GLenum target, + GLenum pname, + GLfloat* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetTexParameterfv(target, pname, params); } } -void GetTexParameteriv( - PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { +void GetTexParameteriv(PP_Resource context_id, + GLenum target, + GLenum pname, + GLint* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetTexParameteriv(target, pname, params); } } -void GetUniformfv( - PP_Resource context_id, GLuint program, GLint location, GLfloat* params) { +void GetUniformfv(PP_Resource context_id, + GLuint program, + GLint location, + GLfloat* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetUniformfv(program, location, params); } } -void GetUniformiv( - PP_Resource context_id, GLuint program, GLint location, GLint* params) { +void GetUniformiv(PP_Resource context_id, + GLuint program, + GLint location, + GLint* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetUniformiv(program, location, params); } } -GLint GetUniformLocation( - PP_Resource context_id, GLuint program, const char* name) { +GLint GetUniformLocation(PP_Resource context_id, + GLuint program, + const char* name) { Enter3D enter(context_id, true); if (enter.succeeded()) { return ToGles2Impl(&enter)->GetUniformLocation(program, name); @@ -663,24 +749,30 @@ GLint GetUniformLocation( } } -void GetVertexAttribfv( - PP_Resource context_id, GLuint index, GLenum pname, GLfloat* params) { +void GetVertexAttribfv(PP_Resource context_id, + GLuint index, + GLenum pname, + GLfloat* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetVertexAttribfv(index, pname, params); } } -void GetVertexAttribiv( - PP_Resource context_id, GLuint index, GLenum pname, GLint* params) { +void GetVertexAttribiv(PP_Resource context_id, + GLuint index, + GLenum pname, + GLint* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetVertexAttribiv(index, pname, params); } } -void GetVertexAttribPointerv( - PP_Resource context_id, GLuint index, GLenum pname, void** pointer) { +void GetVertexAttribPointerv(PP_Resource context_id, + GLuint index, + GLenum pname, + void** pointer) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetVertexAttribPointerv(index, pname, pointer); @@ -785,9 +877,14 @@ void PolygonOffset(PP_Resource context_id, GLfloat factor, GLfloat units) { } } -void ReadPixels( - PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, void* pixels) { +void ReadPixels(PP_Resource context_id, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + void* pixels) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->ReadPixels(x, y, width, height, format, type, pixels); @@ -801,13 +898,15 @@ void ReleaseShaderCompiler(PP_Resource context_id) { } } -void RenderbufferStorage( - PP_Resource context_id, GLenum target, GLenum internalformat, GLsizei width, - GLsizei height) { +void RenderbufferStorage(PP_Resource context_id, + GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->RenderbufferStorage(target, internalformat, width, height); + ToGles2Impl(&enter) + ->RenderbufferStorage(target, internalformat, width, height); } } @@ -818,27 +917,34 @@ void SampleCoverage(PP_Resource context_id, GLclampf value, GLboolean invert) { } } -void Scissor( - PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height) { +void Scissor(PP_Resource context_id, + GLint x, + GLint y, + GLsizei width, + GLsizei height) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->Scissor(x, y, width, height); } } -void ShaderBinary( - PP_Resource context_id, GLsizei n, const GLuint* shaders, - GLenum binaryformat, const void* binary, GLsizei length) { +void ShaderBinary(PP_Resource context_id, + GLsizei n, + const GLuint* shaders, + GLenum binaryformat, + const void* binary, + GLsizei length) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->ShaderBinary(n, shaders, binaryformat, binary, length); + ToGles2Impl(&enter)->ShaderBinary(n, shaders, binaryformat, binary, length); } } -void ShaderSource( - PP_Resource context_id, GLuint shader, GLsizei count, const char** str, - const GLint* length) { +void ShaderSource(PP_Resource context_id, + GLuint shader, + GLsizei count, + const char** str, + const GLint* length) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->ShaderSource(shader, count, str, length); @@ -852,8 +958,11 @@ void StencilFunc(PP_Resource context_id, GLenum func, GLint ref, GLuint mask) { } } -void StencilFuncSeparate( - PP_Resource context_id, GLenum face, GLenum func, GLint ref, GLuint mask) { +void StencilFuncSeparate(PP_Resource context_id, + GLenum face, + GLenum func, + GLint ref, + GLuint mask) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->StencilFuncSeparate(face, func, ref, mask); @@ -874,79 +983,105 @@ void StencilMaskSeparate(PP_Resource context_id, GLenum face, GLuint mask) { } } -void StencilOp( - PP_Resource context_id, GLenum fail, GLenum zfail, GLenum zpass) { +void StencilOp(PP_Resource context_id, + GLenum fail, + GLenum zfail, + GLenum zpass) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->StencilOp(fail, zfail, zpass); } } -void StencilOpSeparate( - PP_Resource context_id, GLenum face, GLenum fail, GLenum zfail, - GLenum zpass) { +void StencilOpSeparate(PP_Resource context_id, + GLenum face, + GLenum fail, + GLenum zfail, + GLenum zpass) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->StencilOpSeparate(face, fail, zfail, zpass); } } -void TexImage2D( - PP_Resource context_id, GLenum target, GLint level, GLint internalformat, - GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, - const void* pixels) { +void TexImage2D(PP_Resource context_id, + GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->TexImage2D( - target, level, internalformat, width, height, border, format, type, - pixels); + ToGles2Impl(&enter)->TexImage2D(target, + level, + internalformat, + width, + height, + border, + format, + type, + pixels); } } -void TexParameterf( - PP_Resource context_id, GLenum target, GLenum pname, GLfloat param) { +void TexParameterf(PP_Resource context_id, + GLenum target, + GLenum pname, + GLfloat param) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->TexParameterf(target, pname, param); } } -void TexParameterfv( - PP_Resource context_id, GLenum target, GLenum pname, - const GLfloat* params) { +void TexParameterfv(PP_Resource context_id, + GLenum target, + GLenum pname, + const GLfloat* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->TexParameterfv(target, pname, params); } } -void TexParameteri( - PP_Resource context_id, GLenum target, GLenum pname, GLint param) { +void TexParameteri(PP_Resource context_id, + GLenum target, + GLenum pname, + GLint param) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->TexParameteri(target, pname, param); } } -void TexParameteriv( - PP_Resource context_id, GLenum target, GLenum pname, const GLint* params) { +void TexParameteriv(PP_Resource context_id, + GLenum target, + GLenum pname, + const GLint* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->TexParameteriv(target, pname, params); } } -void TexSubImage2D( - PP_Resource context_id, GLenum target, GLint level, GLint xoffset, - GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, - const void* pixels) { +void TexSubImage2D(PP_Resource context_id, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* pixels) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->TexSubImage2D( - target, level, xoffset, yoffset, width, height, format, type, - pixels); + ToGles2Impl(&enter)->TexSubImage2D( + target, level, xoffset, yoffset, width, height, format, type, pixels); } } @@ -957,8 +1092,10 @@ void Uniform1f(PP_Resource context_id, GLint location, GLfloat x) { } } -void Uniform1fv( - PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { +void Uniform1fv(PP_Resource context_id, + GLint location, + GLsizei count, + const GLfloat* v) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->Uniform1fv(location, count, v); @@ -972,8 +1109,10 @@ void Uniform1i(PP_Resource context_id, GLint location, GLint x) { } } -void Uniform1iv( - PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { +void Uniform1iv(PP_Resource context_id, + GLint location, + GLsizei count, + const GLint* v) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->Uniform1iv(location, count, v); @@ -987,8 +1126,10 @@ void Uniform2f(PP_Resource context_id, GLint location, GLfloat x, GLfloat y) { } } -void Uniform2fv( - PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { +void Uniform2fv(PP_Resource context_id, + GLint location, + GLsizei count, + const GLfloat* v) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->Uniform2fv(location, count, v); @@ -1002,101 +1143,129 @@ void Uniform2i(PP_Resource context_id, GLint location, GLint x, GLint y) { } } -void Uniform2iv( - PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { +void Uniform2iv(PP_Resource context_id, + GLint location, + GLsizei count, + const GLint* v) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->Uniform2iv(location, count, v); } } -void Uniform3f( - PP_Resource context_id, GLint location, GLfloat x, GLfloat y, GLfloat z) { +void Uniform3f(PP_Resource context_id, + GLint location, + GLfloat x, + GLfloat y, + GLfloat z) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->Uniform3f(location, x, y, z); } } -void Uniform3fv( - PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { +void Uniform3fv(PP_Resource context_id, + GLint location, + GLsizei count, + const GLfloat* v) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->Uniform3fv(location, count, v); } } -void Uniform3i( - PP_Resource context_id, GLint location, GLint x, GLint y, GLint z) { +void Uniform3i(PP_Resource context_id, + GLint location, + GLint x, + GLint y, + GLint z) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->Uniform3i(location, x, y, z); } } -void Uniform3iv( - PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { +void Uniform3iv(PP_Resource context_id, + GLint location, + GLsizei count, + const GLint* v) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->Uniform3iv(location, count, v); } } -void Uniform4f( - PP_Resource context_id, GLint location, GLfloat x, GLfloat y, GLfloat z, - GLfloat w) { +void Uniform4f(PP_Resource context_id, + GLint location, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->Uniform4f(location, x, y, z, w); } } -void Uniform4fv( - PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { +void Uniform4fv(PP_Resource context_id, + GLint location, + GLsizei count, + const GLfloat* v) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->Uniform4fv(location, count, v); } } -void Uniform4i( - PP_Resource context_id, GLint location, GLint x, GLint y, GLint z, - GLint w) { +void Uniform4i(PP_Resource context_id, + GLint location, + GLint x, + GLint y, + GLint z, + GLint w) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->Uniform4i(location, x, y, z, w); } } -void Uniform4iv( - PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { +void Uniform4iv(PP_Resource context_id, + GLint location, + GLsizei count, + const GLint* v) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->Uniform4iv(location, count, v); } } -void UniformMatrix2fv( - PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose, - const GLfloat* value) { +void UniformMatrix2fv(PP_Resource context_id, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->UniformMatrix2fv(location, count, transpose, value); } } -void UniformMatrix3fv( - PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose, - const GLfloat* value) { +void UniformMatrix3fv(PP_Resource context_id, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->UniformMatrix3fv(location, count, transpose, value); } } -void UniformMatrix4fv( - PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose, - const GLfloat* value) { +void UniformMatrix4fv(PP_Resource context_id, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->UniformMatrix4fv(location, count, transpose, value); @@ -1124,103 +1293,125 @@ void VertexAttrib1f(PP_Resource context_id, GLuint indx, GLfloat x) { } } -void VertexAttrib1fv( - PP_Resource context_id, GLuint indx, const GLfloat* values) { +void VertexAttrib1fv(PP_Resource context_id, + GLuint indx, + const GLfloat* values) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->VertexAttrib1fv(indx, values); } } -void VertexAttrib2f( - PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y) { +void VertexAttrib2f(PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->VertexAttrib2f(indx, x, y); } } -void VertexAttrib2fv( - PP_Resource context_id, GLuint indx, const GLfloat* values) { +void VertexAttrib2fv(PP_Resource context_id, + GLuint indx, + const GLfloat* values) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->VertexAttrib2fv(indx, values); } } -void VertexAttrib3f( - PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y, GLfloat z) { +void VertexAttrib3f(PP_Resource context_id, + GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->VertexAttrib3f(indx, x, y, z); } } -void VertexAttrib3fv( - PP_Resource context_id, GLuint indx, const GLfloat* values) { +void VertexAttrib3fv(PP_Resource context_id, + GLuint indx, + const GLfloat* values) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->VertexAttrib3fv(indx, values); } } -void VertexAttrib4f( - PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y, GLfloat z, - GLfloat w) { +void VertexAttrib4f(PP_Resource context_id, + GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->VertexAttrib4f(indx, x, y, z, w); } } -void VertexAttrib4fv( - PP_Resource context_id, GLuint indx, const GLfloat* values) { +void VertexAttrib4fv(PP_Resource context_id, + GLuint indx, + const GLfloat* values) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->VertexAttrib4fv(indx, values); } } -void VertexAttribPointer( - PP_Resource context_id, GLuint indx, GLint size, GLenum type, - GLboolean normalized, GLsizei stride, const void* ptr) { +void VertexAttribPointer(PP_Resource context_id, + GLuint indx, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + const void* ptr) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->VertexAttribPointer( - indx, size, type, normalized, stride, ptr); + ToGles2Impl(&enter) + ->VertexAttribPointer(indx, size, type, normalized, stride, ptr); } } -void Viewport( - PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height) { +void Viewport(PP_Resource context_id, + GLint x, + GLint y, + GLsizei width, + GLsizei height) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->Viewport(x, y, width, height); } } -void BlitFramebufferEXT( - PP_Resource context_id, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, - GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, - GLenum filter) { +void BlitFramebufferEXT(PP_Resource context_id, + GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->BlitFramebufferCHROMIUM( - srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, - filter); + ToGles2Impl(&enter)->BlitFramebufferCHROMIUM( + srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } } -void RenderbufferStorageMultisampleEXT( - PP_Resource context_id, GLenum target, GLsizei samples, - GLenum internalformat, GLsizei width, GLsizei height) { +void RenderbufferStorageMultisampleEXT(PP_Resource context_id, + GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->RenderbufferStorageMultisampleCHROMIUM( - target, samples, internalformat, width, height); + ToGles2Impl(&enter)->RenderbufferStorageMultisampleCHROMIUM( + target, samples, internalformat, width, height); } } @@ -1231,8 +1422,9 @@ void GenQueriesEXT(PP_Resource context_id, GLsizei n, GLuint* queries) { } } -void DeleteQueriesEXT( - PP_Resource context_id, GLsizei n, const GLuint* queries) { +void DeleteQueriesEXT(PP_Resource context_id, + GLsizei n, + const GLuint* queries) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->DeleteQueriesEXT(n, queries); @@ -1262,16 +1454,20 @@ void EndQueryEXT(PP_Resource context_id, GLenum target) { } } -void GetQueryivEXT( - PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { +void GetQueryivEXT(PP_Resource context_id, + GLenum target, + GLenum pname, + GLint* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetQueryivEXT(target, pname, params); } } -void GetQueryObjectuivEXT( - PP_Resource context_id, GLuint id, GLenum pname, GLuint* params) { +void GetQueryObjectuivEXT(PP_Resource context_id, + GLuint id, + GLenum pname, + GLuint* params) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->GetQueryObjectuivEXT(id, pname, params); @@ -1287,13 +1483,15 @@ GLboolean EnableFeatureCHROMIUM(PP_Resource context_id, const char* feature) { } } -void* MapBufferSubDataCHROMIUM( - PP_Resource context_id, GLuint target, GLintptr offset, GLsizeiptr size, - GLenum access) { +void* MapBufferSubDataCHROMIUM(PP_Resource context_id, + GLuint target, + GLintptr offset, + GLsizeiptr size, + GLenum access) { Enter3D enter(context_id, true); if (enter.succeeded()) { - return ToGles2Impl( - &enter)->MapBufferSubDataCHROMIUM(target, offset, size, access); + return ToGles2Impl(&enter) + ->MapBufferSubDataCHROMIUM(target, offset, size, access); } else { return NULL; } @@ -1306,16 +1504,20 @@ void UnmapBufferSubDataCHROMIUM(PP_Resource context_id, const void* mem) { } } -void* MapTexSubImage2DCHROMIUM( - PP_Resource context_id, GLenum target, GLint level, GLint xoffset, - GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, - GLenum access) { +void* MapTexSubImage2DCHROMIUM(PP_Resource context_id, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLenum access) { Enter3D enter(context_id, true); if (enter.succeeded()) { - return ToGles2Impl( - &enter)->MapTexSubImage2DCHROMIUM( - target, level, xoffset, yoffset, width, height, format, type, - access); + return ToGles2Impl(&enter)->MapTexSubImage2DCHROMIUM( + target, level, xoffset, yoffset, width, height, format, type, access); } else { return NULL; } @@ -1328,29 +1530,34 @@ void UnmapTexSubImage2DCHROMIUM(PP_Resource context_id, const void* mem) { } } -void DrawArraysInstancedANGLE( - PP_Resource context_id, GLenum mode, GLint first, GLsizei count, - GLsizei primcount) { +void DrawArraysInstancedANGLE(PP_Resource context_id, + GLenum mode, + GLint first, + GLsizei count, + GLsizei primcount) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->DrawArraysInstancedANGLE(mode, first, count, primcount); + ToGles2Impl(&enter) + ->DrawArraysInstancedANGLE(mode, first, count, primcount); } } -void DrawElementsInstancedANGLE( - PP_Resource context_id, GLenum mode, GLsizei count, GLenum type, - const void* indices, GLsizei primcount) { +void DrawElementsInstancedANGLE(PP_Resource context_id, + GLenum mode, + GLsizei count, + GLenum type, + const void* indices, + GLsizei primcount) { Enter3D enter(context_id, true); if (enter.succeeded()) { - ToGles2Impl( - &enter)->DrawElementsInstancedANGLE( - mode, count, type, indices, primcount); + ToGles2Impl(&enter) + ->DrawElementsInstancedANGLE(mode, count, type, indices, primcount); } } -void VertexAttribDivisorANGLE( - PP_Resource context_id, GLuint index, GLuint divisor) { +void VertexAttribDivisorANGLE(PP_Resource context_id, + GLuint index, + GLuint divisor) { Enter3D enter(context_id, true); if (enter.succeeded()) { ToGles2Impl(&enter)->VertexAttribDivisorANGLE(index, divisor); @@ -1360,196 +1567,115 @@ void VertexAttribDivisorANGLE( } // namespace const PPB_OpenGLES2* PPB_OpenGLES2_Shared::GetInterface() { static const struct PPB_OpenGLES2 ppb_opengles2 = { - &ActiveTexture, - &AttachShader, - &BindAttribLocation, - &BindBuffer, - &BindFramebuffer, - &BindRenderbuffer, - &BindTexture, - &BlendColor, - &BlendEquation, - &BlendEquationSeparate, - &BlendFunc, - &BlendFuncSeparate, - &BufferData, - &BufferSubData, - &CheckFramebufferStatus, - &Clear, - &ClearColor, - &ClearDepthf, - &ClearStencil, - &ColorMask, - &CompileShader, - &CompressedTexImage2D, - &CompressedTexSubImage2D, - &CopyTexImage2D, - &CopyTexSubImage2D, - &CreateProgram, - &CreateShader, - &CullFace, - &DeleteBuffers, - &DeleteFramebuffers, - &DeleteProgram, - &DeleteRenderbuffers, - &DeleteShader, - &DeleteTextures, - &DepthFunc, - &DepthMask, - &DepthRangef, - &DetachShader, - &Disable, - &DisableVertexAttribArray, - &DrawArrays, - &DrawElements, - &Enable, - &EnableVertexAttribArray, - &Finish, - &Flush, - &FramebufferRenderbuffer, - &FramebufferTexture2D, - &FrontFace, - &GenBuffers, - &GenerateMipmap, - &GenFramebuffers, - &GenRenderbuffers, - &GenTextures, - &GetActiveAttrib, - &GetActiveUniform, - &GetAttachedShaders, - &GetAttribLocation, - &GetBooleanv, - &GetBufferParameteriv, - &GetError, - &GetFloatv, - &GetFramebufferAttachmentParameteriv, - &GetIntegerv, - &GetProgramiv, - &GetProgramInfoLog, - &GetRenderbufferParameteriv, - &GetShaderiv, - &GetShaderInfoLog, - &GetShaderPrecisionFormat, - &GetShaderSource, - &GetString, - &GetTexParameterfv, - &GetTexParameteriv, - &GetUniformfv, - &GetUniformiv, - &GetUniformLocation, - &GetVertexAttribfv, - &GetVertexAttribiv, - &GetVertexAttribPointerv, - &Hint, - &IsBuffer, - &IsEnabled, - &IsFramebuffer, - &IsProgram, - &IsRenderbuffer, - &IsShader, - &IsTexture, - &LineWidth, - &LinkProgram, - &PixelStorei, - &PolygonOffset, - &ReadPixels, - &ReleaseShaderCompiler, - &RenderbufferStorage, - &SampleCoverage, - &Scissor, - &ShaderBinary, - &ShaderSource, - &StencilFunc, - &StencilFuncSeparate, - &StencilMask, - &StencilMaskSeparate, - &StencilOp, - &StencilOpSeparate, - &TexImage2D, - &TexParameterf, - &TexParameterfv, - &TexParameteri, - &TexParameteriv, - &TexSubImage2D, - &Uniform1f, - &Uniform1fv, - &Uniform1i, - &Uniform1iv, - &Uniform2f, - &Uniform2fv, - &Uniform2i, - &Uniform2iv, - &Uniform3f, - &Uniform3fv, - &Uniform3i, - &Uniform3iv, - &Uniform4f, - &Uniform4fv, - &Uniform4i, - &Uniform4iv, - &UniformMatrix2fv, - &UniformMatrix3fv, - &UniformMatrix4fv, - &UseProgram, - &ValidateProgram, - &VertexAttrib1f, - &VertexAttrib1fv, - &VertexAttrib2f, - &VertexAttrib2fv, - &VertexAttrib3f, - &VertexAttrib3fv, - &VertexAttrib4f, - &VertexAttrib4fv, - &VertexAttribPointer, - &Viewport - }; + &ActiveTexture, &AttachShader, + &BindAttribLocation, &BindBuffer, + &BindFramebuffer, &BindRenderbuffer, + &BindTexture, &BlendColor, + &BlendEquation, &BlendEquationSeparate, + &BlendFunc, &BlendFuncSeparate, + &BufferData, &BufferSubData, + &CheckFramebufferStatus, &Clear, + &ClearColor, &ClearDepthf, + &ClearStencil, &ColorMask, + &CompileShader, &CompressedTexImage2D, + &CompressedTexSubImage2D, &CopyTexImage2D, + &CopyTexSubImage2D, &CreateProgram, + &CreateShader, &CullFace, + &DeleteBuffers, &DeleteFramebuffers, + &DeleteProgram, &DeleteRenderbuffers, + &DeleteShader, &DeleteTextures, + &DepthFunc, &DepthMask, + &DepthRangef, &DetachShader, + &Disable, &DisableVertexAttribArray, + &DrawArrays, &DrawElements, + &Enable, &EnableVertexAttribArray, + &Finish, &Flush, + &FramebufferRenderbuffer, &FramebufferTexture2D, + &FrontFace, &GenBuffers, + &GenerateMipmap, &GenFramebuffers, + &GenRenderbuffers, &GenTextures, + &GetActiveAttrib, &GetActiveUniform, + &GetAttachedShaders, &GetAttribLocation, + &GetBooleanv, &GetBufferParameteriv, + &GetError, &GetFloatv, + &GetFramebufferAttachmentParameteriv, &GetIntegerv, + &GetProgramiv, &GetProgramInfoLog, + &GetRenderbufferParameteriv, &GetShaderiv, + &GetShaderInfoLog, &GetShaderPrecisionFormat, + &GetShaderSource, &GetString, + &GetTexParameterfv, &GetTexParameteriv, + &GetUniformfv, &GetUniformiv, + &GetUniformLocation, &GetVertexAttribfv, + &GetVertexAttribiv, &GetVertexAttribPointerv, + &Hint, &IsBuffer, + &IsEnabled, &IsFramebuffer, + &IsProgram, &IsRenderbuffer, + &IsShader, &IsTexture, + &LineWidth, &LinkProgram, + &PixelStorei, &PolygonOffset, + &ReadPixels, &ReleaseShaderCompiler, + &RenderbufferStorage, &SampleCoverage, + &Scissor, &ShaderBinary, + &ShaderSource, &StencilFunc, + &StencilFuncSeparate, &StencilMask, + &StencilMaskSeparate, &StencilOp, + &StencilOpSeparate, &TexImage2D, + &TexParameterf, &TexParameterfv, + &TexParameteri, &TexParameteriv, + &TexSubImage2D, &Uniform1f, + &Uniform1fv, &Uniform1i, + &Uniform1iv, &Uniform2f, + &Uniform2fv, &Uniform2i, + &Uniform2iv, &Uniform3f, + &Uniform3fv, &Uniform3i, + &Uniform3iv, &Uniform4f, + &Uniform4fv, &Uniform4i, + &Uniform4iv, &UniformMatrix2fv, + &UniformMatrix3fv, &UniformMatrix4fv, + &UseProgram, &ValidateProgram, + &VertexAttrib1f, &VertexAttrib1fv, + &VertexAttrib2f, &VertexAttrib2fv, + &VertexAttrib3f, &VertexAttrib3fv, + &VertexAttrib4f, &VertexAttrib4fv, + &VertexAttribPointer, &Viewport}; return &ppb_opengles2; } -const PPB_OpenGLES2InstancedArrays* PPB_OpenGLES2_Shared::GetInstancedArraysInterface() { // NOLINT +const PPB_OpenGLES2InstancedArrays* +PPB_OpenGLES2_Shared::GetInstancedArraysInterface() { // NOLINT static const struct PPB_OpenGLES2InstancedArrays ppb_opengles2 = { - &DrawArraysInstancedANGLE, - &DrawElementsInstancedANGLE, - &VertexAttribDivisorANGLE - }; + &DrawArraysInstancedANGLE, &DrawElementsInstancedANGLE, + &VertexAttribDivisorANGLE}; return &ppb_opengles2; } -const PPB_OpenGLES2FramebufferBlit* PPB_OpenGLES2_Shared::GetFramebufferBlitInterface() { // NOLINT +const PPB_OpenGLES2FramebufferBlit* +PPB_OpenGLES2_Shared::GetFramebufferBlitInterface() { // NOLINT static const struct PPB_OpenGLES2FramebufferBlit ppb_opengles2 = { - &BlitFramebufferEXT - }; + &BlitFramebufferEXT}; return &ppb_opengles2; } -const PPB_OpenGLES2FramebufferMultisample* PPB_OpenGLES2_Shared::GetFramebufferMultisampleInterface() { // NOLINT +const PPB_OpenGLES2FramebufferMultisample* +PPB_OpenGLES2_Shared::GetFramebufferMultisampleInterface() { // NOLINT static const struct PPB_OpenGLES2FramebufferMultisample ppb_opengles2 = { - &RenderbufferStorageMultisampleEXT - }; + &RenderbufferStorageMultisampleEXT}; return &ppb_opengles2; } -const PPB_OpenGLES2ChromiumEnableFeature* PPB_OpenGLES2_Shared::GetChromiumEnableFeatureInterface() { // NOLINT +const PPB_OpenGLES2ChromiumEnableFeature* +PPB_OpenGLES2_Shared::GetChromiumEnableFeatureInterface() { // NOLINT static const struct PPB_OpenGLES2ChromiumEnableFeature ppb_opengles2 = { - &EnableFeatureCHROMIUM - }; + &EnableFeatureCHROMIUM}; return &ppb_opengles2; } -const PPB_OpenGLES2ChromiumMapSub* PPB_OpenGLES2_Shared::GetChromiumMapSubInterface() { // NOLINT +const PPB_OpenGLES2ChromiumMapSub* +PPB_OpenGLES2_Shared::GetChromiumMapSubInterface() { // NOLINT static const struct PPB_OpenGLES2ChromiumMapSub ppb_opengles2 = { - &MapBufferSubDataCHROMIUM, - &UnmapBufferSubDataCHROMIUM, - &MapTexSubImage2DCHROMIUM, - &UnmapTexSubImage2DCHROMIUM - }; + &MapBufferSubDataCHROMIUM, &UnmapBufferSubDataCHROMIUM, + &MapTexSubImage2DCHROMIUM, &UnmapTexSubImage2DCHROMIUM}; return &ppb_opengles2; } const PPB_OpenGLES2Query* PPB_OpenGLES2_Shared::GetQueryInterface() { static const struct PPB_OpenGLES2Query ppb_opengles2 = { - &GenQueriesEXT, - &DeleteQueriesEXT, - &IsQueryEXT, - &BeginQueryEXT, - &EndQueryEXT, - &GetQueryivEXT, - &GetQueryObjectuivEXT - }; + &GenQueriesEXT, &DeleteQueriesEXT, &IsQueryEXT, &BeginQueryEXT, + &EndQueryEXT, &GetQueryivEXT, &GetQueryObjectuivEXT}; return &ppb_opengles2; } } // namespace ppapi diff --git a/ppapi/shared_impl/ppb_opengles2_shared.h b/ppapi/shared_impl/ppb_opengles2_shared.h index 8e25dfa..4148571 100644 --- a/ppapi/shared_impl/ppb_opengles2_shared.h +++ b/ppapi/shared_impl/ppb_opengles2_shared.h @@ -27,4 +27,3 @@ class PPAPI_SHARED_EXPORT PPB_OpenGLES2_Shared { } // namespace ppapi #endif // PPAPI_SHARED_IMPL_PPB_OPENGLES2_SHARED_H_ - diff --git a/ppapi/shared_impl/ppb_tcp_socket_shared.cc b/ppapi/shared_impl/ppb_tcp_socket_shared.cc index 934c573..94fb45e 100644 --- a/ppapi/shared_impl/ppb_tcp_socket_shared.cc +++ b/ppapi/shared_impl/ppb_tcp_socket_shared.cc @@ -9,13 +9,11 @@ namespace ppapi { TCPSocketState::TCPSocketState(StateType state) - : state_(state), - pending_transition_(NONE) { + : state_(state), pending_transition_(NONE) { DCHECK(state_ == INITIAL || state_ == CONNECTED); } -TCPSocketState::~TCPSocketState() { -} +TCPSocketState::~TCPSocketState() {} void TCPSocketState::SetPendingTransition(TransitionType pending_transition) { DCHECK(IsValidTransition(pending_transition)); diff --git a/ppapi/shared_impl/ppb_tcp_socket_shared.h b/ppapi/shared_impl/ppb_tcp_socket_shared.h index c723bdc..8228670 100644 --- a/ppapi/shared_impl/ppb_tcp_socket_shared.h +++ b/ppapi/shared_impl/ppb_tcp_socket_shared.h @@ -29,14 +29,7 @@ class PPAPI_SHARED_EXPORT TCPSocketState { // Transitions that will change the socket state. Please note that // read/write/accept are not included because they don't change the socket // state. - enum TransitionType { - NONE, - BIND, - CONNECT, - SSL_CONNECT, - LISTEN, - CLOSE - }; + enum TransitionType { NONE, BIND, CONNECT, SSL_CONNECT, LISTEN, CLOSE }; explicit TCPSocketState(StateType state); ~TCPSocketState(); diff --git a/ppapi/shared_impl/ppb_trace_event_impl.cc b/ppapi/shared_impl/ppb_trace_event_impl.cc index 80037d6..ce1afb9 100644 --- a/ppapi/shared_impl/ppb_trace_event_impl.cc +++ b/ppapi/shared_impl/ppb_trace_event_impl.cc @@ -9,7 +9,6 @@ #include "base/threading/platform_thread.h" #include "ppapi/thunk/thunk.h" - namespace ppapi { // PPB_Trace_Event_Dev is a shared implementation because Trace Events can be @@ -30,27 +29,33 @@ void* TraceEventImpl::GetCategoryEnabled(const char* category_name) { } // static -void TraceEventImpl::AddTraceEvent( - int8_t phase, - const void* category_enabled, - const char* name, - uint64_t id, - uint32_t num_args, - const char* arg_names[], - const uint8_t arg_types[], - const uint64_t arg_values[], - uint8_t flags) { +void TraceEventImpl::AddTraceEvent(int8_t phase, + const void* category_enabled, + const char* name, + uint64_t id, + uint32_t num_args, + const char* arg_names[], + const uint8_t arg_types[], + const uint64_t arg_values[], + uint8_t flags) { COMPILE_ASSERT(sizeof(unsigned long long) == sizeof(uint64_t), msg); - base::debug::TraceLog::GetInstance()->AddTraceEvent(phase, - static_cast<const unsigned char*>(category_enabled), name, id, num_args, - arg_names, arg_types, + base::debug::TraceLog::GetInstance()->AddTraceEvent( + phase, + static_cast<const unsigned char*>(category_enabled), + name, + id, + num_args, + arg_names, + arg_types, // This cast is necessary for LP64 systems, where uint64_t is defined as // an unsigned long int, but trace_event internals are hermetic and // accepts an |unsigned long long*|. The pointer types are compatible but // the compiler throws an error without an explicit cast. - reinterpret_cast<const unsigned long long*>(arg_values), NULL, flags); + reinterpret_cast<const unsigned long long*>(arg_values), + NULL, + flags); } // static @@ -68,15 +73,21 @@ void TraceEventImpl::AddTraceEventWithThreadIdAndTimestamp( uint8_t flags) { base::debug::TraceLog::GetInstance()->AddTraceEventWithThreadIdAndTimestamp( phase, - static_cast<const unsigned char*>(category_enabled), name, id, + static_cast<const unsigned char*>(category_enabled), + name, + id, thread_id, base::TimeTicks::FromInternalValue(timestamp), - num_args, arg_names, arg_types, + num_args, + arg_names, + arg_types, // This cast is necessary for LP64 systems, where uint64_t is defined as // an unsigned long int, but trace_event internals are hermetic and // accepts an |unsigned long long*|. The pointer types are compatible but // the compiler throws an error without an explicit cast. - reinterpret_cast<const unsigned long long*>(arg_values), NULL, flags); + reinterpret_cast<const unsigned long long*>(arg_values), + NULL, + flags); } // static @@ -92,18 +103,15 @@ void TraceEventImpl::SetThreadName(const char* thread_name) { namespace { const PPB_Trace_Event_Dev_0_1 g_ppb_trace_event_thunk_0_1 = { - &TraceEventImpl::GetCategoryEnabled, - &TraceEventImpl::AddTraceEvent, - &TraceEventImpl::SetThreadName, -}; + &TraceEventImpl::GetCategoryEnabled, &TraceEventImpl::AddTraceEvent, + &TraceEventImpl::SetThreadName, }; const PPB_Trace_Event_Dev_0_2 g_ppb_trace_event_thunk_0_2 = { - &TraceEventImpl::GetCategoryEnabled, - &TraceEventImpl::AddTraceEvent, - &TraceEventImpl::AddTraceEventWithThreadIdAndTimestamp, - &TraceEventImpl::Now, - &TraceEventImpl::SetThreadName, -}; + &TraceEventImpl::GetCategoryEnabled, + &TraceEventImpl::AddTraceEvent, + &TraceEventImpl::AddTraceEventWithThreadIdAndTimestamp, + &TraceEventImpl::Now, + &TraceEventImpl::SetThreadName, }; } // namespace ppapi diff --git a/ppapi/shared_impl/ppb_trace_event_impl.h b/ppapi/shared_impl/ppb_trace_event_impl.h index 6df7cc8..b7a5eb4 100644 --- a/ppapi/shared_impl/ppb_trace_event_impl.h +++ b/ppapi/shared_impl/ppb_trace_event_impl.h @@ -18,16 +18,15 @@ namespace ppapi { class PPAPI_SHARED_EXPORT TraceEventImpl { public: static void* GetCategoryEnabled(const char* category_name); - static void AddTraceEvent( - int8_t phase, - const void* category_enabled, - const char* name, - uint64_t id, - uint32_t num_args, - const char* arg_names[], - const uint8_t arg_types[], - const uint64_t arg_values[], - uint8_t flags); + static void AddTraceEvent(int8_t phase, + const void* category_enabled, + const char* name, + uint64_t id, + uint32_t num_args, + const char* arg_names[], + const uint8_t arg_types[], + const uint64_t arg_values[], + uint8_t flags); static void AddTraceEventWithThreadIdAndTimestamp( int8_t phase, const void* category_enabled, diff --git a/ppapi/shared_impl/ppb_url_util_shared.h b/ppapi/shared_impl/ppb_url_util_shared.h index d45557d..3627ac4 100644 --- a/ppapi/shared_impl/ppb_url_util_shared.h +++ b/ppapi/shared_impl/ppb_url_util_shared.h @@ -22,8 +22,7 @@ namespace ppapi { class PPAPI_SHARED_EXPORT PPB_URLUtil_Shared { public: // PPB_URLUtil shared functions. - static PP_Var Canonicalize(PP_Var url, - PP_URLComponents_Dev* components); + static PP_Var Canonicalize(PP_Var url, PP_URLComponents_Dev* components); static PP_Var ResolveRelativeToURL(PP_Var base_url, PP_Var relative, PP_URLComponents_Dev* components); diff --git a/ppapi/shared_impl/ppb_var_shared.cc b/ppapi/shared_impl/ppb_var_shared.cc index 6e1fb27..d256fc1 100644 --- a/ppapi/shared_impl/ppb_var_shared.cc +++ b/ppapi/shared_impl/ppb_var_shared.cc @@ -22,7 +22,6 @@ using ppapi::StringVar; namespace ppapi { namespace { - // PPB_Var methods ------------------------------------------------------------- void AddRefVar(PP_Var var) { @@ -70,29 +69,14 @@ PP_Var VarFromResource(PP_Resource resource) { return PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVar(resource); } -const PPB_Var var_interface = { - &AddRefVar, - &ReleaseVar, - &VarFromUtf8, - &VarToUtf8, - &VarToResource, - &VarFromResource -}; - -const PPB_Var_1_1 var_interface1_1 = { - &AddRefVar, - &ReleaseVar, - &VarFromUtf8, - &VarToUtf8 -}; - -const PPB_Var_1_0 var_interface1_0 = { - &AddRefVar, - &ReleaseVar, - &VarFromUtf8_1_0, - &VarToUtf8 -}; +const PPB_Var var_interface = {&AddRefVar, &ReleaseVar, &VarFromUtf8, + &VarToUtf8, &VarToResource, &VarFromResource}; + +const PPB_Var_1_1 var_interface1_1 = {&AddRefVar, &ReleaseVar, + &VarFromUtf8, &VarToUtf8}; +const PPB_Var_1_0 var_interface1_0 = {&AddRefVar, &ReleaseVar, + &VarFromUtf8_1_0, &VarToUtf8}; // PPB_VarArrayBuffer methods -------------------------------------------------- @@ -127,11 +111,7 @@ void Unmap(PP_Var array) { } const PPB_VarArrayBuffer_1_0 var_arraybuffer_interface = { - &CreateArrayBufferVar, - &ByteLength, - &Map, - &Unmap -}; + &CreateArrayBufferVar, &ByteLength, &Map, &Unmap}; } // namespace diff --git a/ppapi/shared_impl/ppb_video_decoder_shared.cc b/ppapi/shared_impl/ppb_video_decoder_shared.cc index 8b75cc7..97275db 100644 --- a/ppapi/shared_impl/ppb_video_decoder_shared.cc +++ b/ppapi/shared_impl/ppb_video_decoder_shared.cc @@ -16,15 +16,13 @@ namespace ppapi { PPB_VideoDecoder_Shared::PPB_VideoDecoder_Shared(PP_Instance instance) : Resource(OBJECT_IS_IMPL, instance), graphics_context_(0), - gles2_impl_(NULL) { -} + gles2_impl_(NULL) {} PPB_VideoDecoder_Shared::PPB_VideoDecoder_Shared( const HostResource& host_resource) : Resource(OBJECT_IS_PROXY, host_resource), graphics_context_(0), - gles2_impl_(NULL) { -} + gles2_impl_(NULL) {} PPB_VideoDecoder_Shared::~PPB_VideoDecoder_Shared() { // Destroy() must be called before the object is destroyed. @@ -73,8 +71,8 @@ bool PPB_VideoDecoder_Shared::SetResetCallback( bool PPB_VideoDecoder_Shared::SetBitstreamBufferCallback( int32 bitstream_buffer_id, scoped_refptr<TrackedCallback> callback) { - return bitstream_buffer_callbacks_.insert( - std::make_pair(bitstream_buffer_id, callback)).second; + return bitstream_buffer_callbacks_.insert(std::make_pair(bitstream_buffer_id, + callback)).second; } void PPB_VideoDecoder_Shared::RunFlushCallback(int32 result) { @@ -86,7 +84,8 @@ void PPB_VideoDecoder_Shared::RunResetCallback(int32 result) { } void PPB_VideoDecoder_Shared::RunBitstreamBufferCallback( - int32 bitstream_buffer_id, int32 result) { + int32 bitstream_buffer_id, + int32 result) { CallbackById::iterator it = bitstream_buffer_callbacks_.find(bitstream_buffer_id); DCHECK(it != bitstream_buffer_callbacks_.end()); diff --git a/ppapi/shared_impl/ppb_view_shared.cc b/ppapi/shared_impl/ppb_view_shared.cc index f11fe1f..fc19a46 100644 --- a/ppapi/shared_impl/ppb_view_shared.cc +++ b/ppapi/shared_impl/ppb_view_shared.cc @@ -22,8 +22,7 @@ ViewData::ViewData() { css_scale = 1.0f; } -ViewData::~ViewData() { -} +ViewData::~ViewData() {} bool ViewData::Equals(const ViewData& other) const { return rect.point.x == other.rect.point.x && @@ -36,27 +35,19 @@ bool ViewData::Equals(const ViewData& other) const { 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 && - device_scale == other.device_scale && - css_scale == other.css_scale; + device_scale == other.device_scale && css_scale == other.css_scale; } PPB_View_Shared::PPB_View_Shared(ResourceObjectType type, PP_Instance instance, const ViewData& data) - : Resource(type, instance), - data_(data) { -} + : Resource(type, instance), data_(data) {} -PPB_View_Shared::~PPB_View_Shared() { -} +PPB_View_Shared::~PPB_View_Shared() {} -thunk::PPB_View_API* PPB_View_Shared::AsPPB_View_API() { - return this; -} +thunk::PPB_View_API* PPB_View_Shared::AsPPB_View_API() { return this; } -const ViewData& PPB_View_Shared::GetData() const { - return data_; -} +const ViewData& PPB_View_Shared::GetData() const { return data_; } PP_Bool PPB_View_Shared::GetRect(PP_Rect* viewport) const { if (!viewport) @@ -84,12 +75,8 @@ PP_Bool PPB_View_Shared::GetClipRect(PP_Rect* clip) const { return PP_TRUE; } -float PPB_View_Shared::GetDeviceScale() const { - return data_.device_scale; -} +float PPB_View_Shared::GetDeviceScale() const { return data_.device_scale; } -float PPB_View_Shared::GetCSSScale() const { - return data_.css_scale; -} +float PPB_View_Shared::GetCSSScale() const { return data_.css_scale; } } // namespace ppapi diff --git a/ppapi/shared_impl/ppb_view_shared.h b/ppapi/shared_impl/ppb_view_shared.h index 77bf8f2..2ee226d 100644 --- a/ppapi/shared_impl/ppb_view_shared.h +++ b/ppapi/shared_impl/ppb_view_shared.h @@ -29,9 +29,8 @@ struct PPAPI_SHARED_EXPORT ViewData { float css_scale; }; -class PPAPI_SHARED_EXPORT PPB_View_Shared - : public Resource, - public thunk::PPB_View_API { +class PPAPI_SHARED_EXPORT PPB_View_Shared : public Resource, + public thunk::PPB_View_API { public: PPB_View_Shared(ResourceObjectType type, PP_Instance instance, @@ -47,8 +46,7 @@ class PPAPI_SHARED_EXPORT PPB_View_Shared virtual PP_Bool IsFullscreen() const OVERRIDE; virtual PP_Bool IsVisible() const OVERRIDE; virtual PP_Bool IsPageVisible() const OVERRIDE; - virtual PP_Bool GetClipRect(PP_Rect* clip) const - OVERRIDE; + virtual PP_Bool GetClipRect(PP_Rect* clip) const OVERRIDE; virtual float GetDeviceScale() const OVERRIDE; virtual float GetCSSScale() const OVERRIDE; diff --git a/ppapi/shared_impl/ppp_flash_browser_operations_shared.h b/ppapi/shared_impl/ppp_flash_browser_operations_shared.h index c77ad2b..7584390 100644 --- a/ppapi/shared_impl/ppp_flash_browser_operations_shared.h +++ b/ppapi/shared_impl/ppp_flash_browser_operations_shared.h @@ -14,13 +14,10 @@ namespace ppapi { struct FlashSiteSetting { FlashSiteSetting() - : permission(PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT) { - } + : permission(PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT) {} FlashSiteSetting(const std::string& in_site, PP_Flash_BrowserOperations_Permission in_permission) - : site(in_site), - permission(in_permission) { - } + : site(in_site), permission(in_permission) {} std::string site; PP_Flash_BrowserOperations_Permission permission; diff --git a/ppapi/shared_impl/ppp_instance_combined.cc b/ppapi/shared_impl/ppp_instance_combined.cc index 5baaf12..ffde05e 100644 --- a/ppapi/shared_impl/ppp_instance_combined.cc +++ b/ppapi/shared_impl/ppp_instance_combined.cc @@ -40,9 +40,7 @@ PPP_Instance_Combined::PPP_Instance_Combined( PPP_Instance_Combined::PPP_Instance_Combined( const PPP_Instance_1_1& instance_if) - : instance_1_1_(instance_if), - did_change_view_1_0_(NULL) { -} + : instance_1_1_(instance_if), did_change_view_1_0_(NULL) {} PP_Bool PPP_Instance_Combined::DidCreate(PP_Instance instance, uint32_t argc, @@ -60,9 +58,8 @@ void PPP_Instance_Combined::DidChangeView(PP_Instance instance, const struct PP_Rect* position, const struct PP_Rect* clip) { if (instance_1_1_.DidChangeView) { - CallWhileUnlocked(instance_1_1_.DidChangeView, - instance, - view_changed_resource); + CallWhileUnlocked( + instance_1_1_.DidChangeView, instance, view_changed_resource); } else { CallWhileUnlocked(did_change_view_1_0_, instance, position, clip); } @@ -75,10 +72,8 @@ void PPP_Instance_Combined::DidChangeFocus(PP_Instance instance, PP_Bool PPP_Instance_Combined::HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader) { - return CallWhileUnlocked(instance_1_1_.HandleDocumentLoad, - instance, - url_loader); + return CallWhileUnlocked( + 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 a01725e..a29b1bb 100644 --- a/ppapi/shared_impl/ppp_instance_combined.h +++ b/ppapi/shared_impl/ppp_instance_combined.h @@ -60,4 +60,3 @@ struct PPAPI_SHARED_EXPORT PPP_Instance_Combined { } // namespace ppapi #endif // PPAPI_SHARED_IMPL_PPP_INSTANCE_COMBINED_H_ - diff --git a/ppapi/shared_impl/proxy_lock.cc b/ppapi/shared_impl/proxy_lock.cc index 3c1c347..6598379 100644 --- a/ppapi/shared_impl/proxy_lock.cc +++ b/ppapi/shared_impl/proxy_lock.cc @@ -11,8 +11,7 @@ namespace ppapi { -base::LazyInstance<base::Lock>::Leaky - g_proxy_lock = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance<base::Lock>::Leaky g_proxy_lock = LAZY_INSTANCE_INITIALIZER; bool g_disable_locking = false; base::LazyInstance<base::ThreadLocalBoolean>::Leaky @@ -20,8 +19,8 @@ base::LazyInstance<base::ThreadLocalBoolean>::Leaky // Simple single-thread deadlock detector for the proxy lock. // |true| when the current thread has the lock. -base::LazyInstance<base::ThreadLocalBoolean>::Leaky - g_proxy_locked_on_thread = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance<base::ThreadLocalBoolean>::Leaky g_proxy_locked_on_thread = + LAZY_INSTANCE_INITIALIZER; // static base::Lock* ProxyLock::Get() { diff --git a/ppapi/shared_impl/proxy_lock.h b/ppapi/shared_impl/proxy_lock.h index f6dea31..8e82ea6 100644 --- a/ppapi/shared_impl/proxy_lock.h +++ b/ppapi/shared_impl/proxy_lock.h @@ -81,12 +81,9 @@ class PPAPI_SHARED_EXPORT ProxyLock { // such as PPB_Var and PPB_Core. class ProxyAutoLock { public: - ProxyAutoLock() { - ProxyLock::Acquire(); - } - ~ProxyAutoLock() { - ProxyLock::Release(); - } + ProxyAutoLock() { ProxyLock::Acquire(); } + ~ProxyAutoLock() { ProxyLock::Release(); } + private: DISALLOW_COPY_AND_ASSIGN(ProxyAutoLock); }; @@ -97,12 +94,9 @@ class ProxyAutoLock { // exception. class ProxyAutoUnlock { public: - ProxyAutoUnlock() { - ProxyLock::Release(); - } - ~ProxyAutoUnlock() { - ProxyLock::Acquire(); - } + ProxyAutoUnlock() { ProxyLock::Release(); } + ~ProxyAutoUnlock() { ProxyLock::Acquire(); } + private: DISALLOW_COPY_AND_ASSIGN(ProxyAutoUnlock); }; @@ -170,9 +164,9 @@ template <typename RunType> class RunWhileLockedHelper; template <> -class RunWhileLockedHelper<void ()> { +class RunWhileLockedHelper<void()> { public: - typedef base::Callback<void ()> CallbackType; + typedef base::Callback<void()> CallbackType; explicit RunWhileLockedHelper(const CallbackType& callback) : callback_(new CallbackType(callback)) { // Copying |callback| may adjust reference counts for bound Vars or @@ -224,6 +218,7 @@ class RunWhileLockedHelper<void ()> { callback_.reset(); } } + private: scoped_ptr<CallbackType> callback_; @@ -232,9 +227,9 @@ class RunWhileLockedHelper<void ()> { }; template <typename P1> -class RunWhileLockedHelper<void (P1)> { +class RunWhileLockedHelper<void(P1)> { public: - typedef base::Callback<void (P1)> CallbackType; + typedef base::Callback<void(P1)> CallbackType; explicit RunWhileLockedHelper(const CallbackType& callback) : callback_(new CallbackType(callback)) { ProxyLock::AssertAcquired(); @@ -255,15 +250,16 @@ class RunWhileLockedHelper<void (P1)> { callback_.reset(); } } + private: scoped_ptr<CallbackType> callback_; base::ThreadChecker thread_checker_; }; template <typename P1, typename P2> -class RunWhileLockedHelper<void (P1, P2)> { +class RunWhileLockedHelper<void(P1, P2)> { public: - typedef base::Callback<void (P1, P2)> CallbackType; + typedef base::Callback<void(P1, P2)> CallbackType; explicit RunWhileLockedHelper(const CallbackType& callback) : callback_(new CallbackType(callback)) { ProxyLock::AssertAcquired(); @@ -284,15 +280,16 @@ class RunWhileLockedHelper<void (P1, P2)> { callback_.reset(); } } + private: scoped_ptr<CallbackType> callback_; base::ThreadChecker thread_checker_; }; template <typename P1, typename P2, typename P3> -class RunWhileLockedHelper<void (P1, P2, P3)> { +class RunWhileLockedHelper<void(P1, P2, P3)> { public: - typedef base::Callback<void (P1, P2, P3)> CallbackType; + typedef base::Callback<void(P1, P2, P3)> CallbackType; explicit RunWhileLockedHelper(const CallbackType& callback) : callback_(new CallbackType(callback)) { ProxyLock::AssertAcquired(); @@ -313,6 +310,7 @@ class RunWhileLockedHelper<void (P1, P2, P3)> { callback_.reset(); } } + private: scoped_ptr<CallbackType> callback_; base::ThreadChecker thread_checker_; @@ -349,8 +347,8 @@ class RunWhileLockedHelper<void (P1, P2, P3)> { // was run (but can be destroyed with or without the proxy lock acquired). Or // (3) destroyed without the proxy lock acquired. template <class FunctionType> -inline base::Callback<FunctionType> -RunWhileLocked(const base::Callback<FunctionType>& callback) { +inline base::Callback<FunctionType> RunWhileLocked( + const base::Callback<FunctionType>& callback) { internal::RunWhileLockedHelper<FunctionType>* helper = new internal::RunWhileLockedHelper<FunctionType>(callback); return base::Bind( diff --git a/ppapi/shared_impl/proxy_lock_unittest.cc b/ppapi/shared_impl/proxy_lock_unittest.cc index f075149..c533b5b 100644 --- a/ppapi/shared_impl/proxy_lock_unittest.cc +++ b/ppapi/shared_impl/proxy_lock_unittest.cc @@ -34,14 +34,11 @@ class CheckLockStateInDestructor : public base::RefCounted<CheckLockStateInDestructor> { public: CheckLockStateInDestructor() {} - void Method() { - ++called_num; - } + void Method() { ++called_num; } + private: friend class base::RefCounted<CheckLockStateInDestructor>; - ~CheckLockStateInDestructor() { - CheckLockState(); - } + ~CheckLockStateInDestructor() { CheckLockState(); } DISALLOW_COPY_AND_ASSIGN(CheckLockStateInDestructor); }; @@ -93,9 +90,8 @@ TEST(PpapiProxyLockTest, Locking) { ProxyAutoLock lock; scoped_refptr<CheckLockStateInDestructor> object = new CheckLockStateInDestructor(); - cb0 = RunWhileLocked( - base::Bind(&CheckLockStateInDestructor::Method, - object)); + cb0 = + RunWhileLocked(base::Bind(&CheckLockStateInDestructor::Method, object)); // Note after this scope, the Callback owns the only reference. } cb0.Run(); @@ -158,18 +154,21 @@ TEST(PpapiProxyLockTest, Unlocking) { CallWhileUnlocked(TestCallback_0); ASSERT_EQ(1, called_num); called_num = 0; - } { + } + { CallWhileUnlocked(TestCallback_1, 123); ASSERT_EQ(1, called_num); called_num = 0; - } { + } + { // TODO(dmichael): Make const-ref arguments work properly with type // deduction. CallWhileUnlocked<void, int, const std::string&>( TestCallback_2, 123, std::string("yo")); ASSERT_EQ(1, called_num); called_num = 0; - } { + } + { base::Callback<void()> callback(base::Bind(TestCallback_0)); CallWhileUnlocked(callback); ASSERT_EQ(1, called_num); diff --git a/ppapi/shared_impl/resource.cc b/ppapi/shared_impl/resource.cc index 2c40961..e7ed708 100644 --- a/ppapi/shared_impl/resource.cc +++ b/ppapi/shared_impl/resource.cc @@ -44,9 +44,7 @@ Resource::Resource(Untracked) { pp_resource_ = PpapiGlobals::Get()->GetResourceTracker()->AddResource(this); } -Resource::~Resource() { - RemoveFromResourceTracker(); -} +Resource::~Resource() { RemoveFromResourceTracker(); } PP_Resource Resource::GetReference() { PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(pp_resource()); @@ -75,8 +73,8 @@ void Resource::OnReplyReceived(const proxy::ResourceMessageReplyParams& params, } void Resource::Log(PP_LogLevel level, const std::string& message) { - PpapiGlobals::Get()->LogWithSource(pp_instance(), level, std::string(), - message); + PpapiGlobals::Get()->LogWithSource( + pp_instance(), level, std::string(), message); } void Resource::RemoveFromResourceTracker() { @@ -89,4 +87,3 @@ FOR_ALL_PPAPI_RESOURCE_APIS(DEFINE_TYPE_GETTER) #undef DEFINE_TYPE_GETTER } // namespace ppapi - diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h index b9821c06..9c22cf6 100644 --- a/ppapi/shared_impl/resource.h +++ b/ppapi/shared_impl/resource.h @@ -18,76 +18,76 @@ // All resource types should be added here. This implements our hand-rolled // RTTI system since we don't compile with "real" RTTI. -#define FOR_ALL_PPAPI_RESOURCE_APIS(F) \ - F(ExtensionsCommon_API) \ - F(PPB_Audio_API) \ - F(PPB_AudioBuffer_API) \ - F(PPB_AudioConfig_API) \ - F(PPB_AudioInput_API) \ - F(PPB_AudioTrusted_API) \ - F(PPB_Broker_API) \ - F(PPB_Broker_Instance_API) \ - F(PPB_BrowserFont_Singleton_API) \ - F(PPB_BrowserFont_Trusted_API) \ - F(PPB_Buffer_API) \ - F(PPB_DeviceRef_API) \ - F(PPB_Ext_CrxFileSystem_Private_API) \ - F(PPB_FileChooser_API) \ - F(PPB_FileIO_API) \ - F(PPB_FileMapping_API) \ - F(PPB_FileRef_API) \ - F(PPB_FileSystem_API) \ - F(PPB_Find_API) \ - F(PPB_Flash_Clipboard_API) \ - F(PPB_Flash_DRM_API) \ - F(PPB_Flash_File_API) \ - F(PPB_Flash_FontFile_API) \ - F(PPB_Flash_Fullscreen_API) \ - F(PPB_Flash_Functions_API) \ - F(PPB_Flash_Menu_API) \ - F(PPB_Flash_MessageLoop_API) \ - F(PPB_Gamepad_API) \ - F(PPB_Graphics2D_API) \ - F(PPB_Graphics3D_API) \ - F(PPB_HostResolver_API) \ - F(PPB_HostResolver_Private_API) \ - F(PPB_ImageData_API) \ - F(PPB_InputEvent_API) \ +#define FOR_ALL_PPAPI_RESOURCE_APIS(F) \ + F(ExtensionsCommon_API) \ + F(PPB_Audio_API) \ + F(PPB_AudioBuffer_API) \ + F(PPB_AudioConfig_API) \ + F(PPB_AudioInput_API) \ + F(PPB_AudioTrusted_API) \ + F(PPB_Broker_API) \ + F(PPB_Broker_Instance_API) \ + F(PPB_BrowserFont_Singleton_API) \ + F(PPB_BrowserFont_Trusted_API) \ + F(PPB_Buffer_API) \ + F(PPB_DeviceRef_API) \ + F(PPB_Ext_CrxFileSystem_Private_API) \ + F(PPB_FileChooser_API) \ + F(PPB_FileIO_API) \ + F(PPB_FileMapping_API) \ + F(PPB_FileRef_API) \ + F(PPB_FileSystem_API) \ + F(PPB_Find_API) \ + F(PPB_Flash_Clipboard_API) \ + F(PPB_Flash_DRM_API) \ + F(PPB_Flash_File_API) \ + F(PPB_Flash_FontFile_API) \ + F(PPB_Flash_Fullscreen_API) \ + F(PPB_Flash_Functions_API) \ + F(PPB_Flash_Menu_API) \ + F(PPB_Flash_MessageLoop_API) \ + F(PPB_Gamepad_API) \ + F(PPB_Graphics2D_API) \ + F(PPB_Graphics3D_API) \ + F(PPB_HostResolver_API) \ + F(PPB_HostResolver_Private_API) \ + F(PPB_ImageData_API) \ + F(PPB_InputEvent_API) \ F(PPB_IsolatedFileSystem_Private_API) \ - F(PPB_LayerCompositor_API) \ - F(PPB_MediaStreamAudioTrack_API) \ - F(PPB_MediaStreamVideoTrack_API) \ - F(PPB_MessageLoop_API) \ - F(PPB_NetAddress_API) \ - F(PPB_NetworkList_API) \ - F(PPB_NetworkMonitor_API) \ - F(PPB_NetworkProxy_API) \ - F(PPB_OutputProtection_API) \ - F(PPB_PDF_API) \ - F(PPB_PlatformVerification_API) \ - F(PPB_Printing_API) \ - F(PPB_Scrollbar_API) \ - F(PPB_Talk_Private_API) \ - F(PPB_TrueTypeFont_API) \ - F(PPB_TrueTypeFont_Singleton_API) \ - F(PPB_TCPServerSocket_Private_API) \ - F(PPB_TCPSocket_API) \ - F(PPB_TCPSocket_Private_API) \ - F(PPB_UDPSocket_API) \ - F(PPB_UDPSocket_Private_API) \ - F(PPB_UMA_Singleton_API) \ - F(PPB_URLLoader_API) \ - F(PPB_URLRequestInfo_API) \ - F(PPB_URLResponseInfo_API) \ - F(PPB_VideoCapture_API) \ - F(PPB_VideoDecoder_API) \ - F(PPB_VideoDestination_Private_API) \ - F(PPB_VideoFrame_API) \ - F(PPB_VideoLayer_API) \ - F(PPB_VideoSource_Private_API) \ - F(PPB_View_API) \ - F(PPB_WebSocket_API) \ - F(PPB_Widget_API) \ + F(PPB_LayerCompositor_API) \ + F(PPB_MediaStreamAudioTrack_API) \ + F(PPB_MediaStreamVideoTrack_API) \ + F(PPB_MessageLoop_API) \ + F(PPB_NetAddress_API) \ + F(PPB_NetworkList_API) \ + F(PPB_NetworkMonitor_API) \ + F(PPB_NetworkProxy_API) \ + F(PPB_OutputProtection_API) \ + F(PPB_PDF_API) \ + F(PPB_PlatformVerification_API) \ + F(PPB_Printing_API) \ + F(PPB_Scrollbar_API) \ + F(PPB_Talk_Private_API) \ + F(PPB_TrueTypeFont_API) \ + F(PPB_TrueTypeFont_Singleton_API) \ + F(PPB_TCPServerSocket_Private_API) \ + F(PPB_TCPSocket_API) \ + F(PPB_TCPSocket_Private_API) \ + F(PPB_UDPSocket_API) \ + F(PPB_UDPSocket_Private_API) \ + F(PPB_UMA_Singleton_API) \ + F(PPB_URLLoader_API) \ + F(PPB_URLRequestInfo_API) \ + F(PPB_URLResponseInfo_API) \ + F(PPB_VideoCapture_API) \ + F(PPB_VideoDecoder_API) \ + F(PPB_VideoDestination_Private_API) \ + F(PPB_VideoFrame_API) \ + F(PPB_VideoLayer_API) \ + F(PPB_VideoSource_Private_API) \ + F(PPB_View_API) \ + F(PPB_WebSocket_API) \ + F(PPB_Widget_API) \ F(PPB_X509Certificate_Private_API) namespace IPC { @@ -113,10 +113,7 @@ FOR_ALL_PPAPI_RESOURCE_APIS(DECLARE_RESOURCE_CLASS) // in-process ("impl") resource in the host (renderer) process, or when they're // a proxied resource in the plugin process. This enum differentiates those // cases. -enum ResourceObjectType { - OBJECT_IS_IMPL, - OBJECT_IS_PROXY -}; +enum ResourceObjectType { OBJECT_IS_IMPL, OBJECT_IS_PROXY }; class PPAPI_SHARED_EXPORT Resource : public base::RefCounted<Resource> { public: @@ -195,19 +192,19 @@ class PPAPI_SHARED_EXPORT Resource : public base::RefCounted<Resource> { // InstanceWasDeleted() to be notified. virtual void NotifyInstanceWasDeleted(); - // Dynamic casting for this object. Returns the pointer to the given type if - // it's supported. Derived classes override the functions they support to - // return the interface. - #define DEFINE_TYPE_GETTER(RESOURCE) \ - virtual thunk::RESOURCE* As##RESOURCE(); +// Dynamic casting for this object. Returns the pointer to the given type if +// it's supported. Derived classes override the functions they support to +// return the interface. +#define DEFINE_TYPE_GETTER(RESOURCE) virtual thunk::RESOURCE* As##RESOURCE(); FOR_ALL_PPAPI_RESOURCE_APIS(DEFINE_TYPE_GETTER) - #undef DEFINE_TYPE_GETTER +#undef DEFINE_TYPE_GETTER // Template-based dynamic casting. See specializations below. This is // unimplemented for the default case. This way, for anything that's not a // resource (or if a developer forgets to add the resource to the list in // this file), the result is a linker error. - template <typename T> T* GetAs(); + template <typename T> + T* GetAs(); // Called when a PpapiPluginMsg_ResourceReply reply is received for a // previous CallRenderer. The message is the nested reply message, which may @@ -248,9 +245,10 @@ class PPAPI_SHARED_EXPORT Resource : public base::RefCounted<Resource> { // Template-based dynamic casting. These specializations forward to the // AsXXX virtual functions to return whether the given type is supported. -#define DEFINE_RESOURCE_CAST(RESOURCE) \ - template<> inline thunk::RESOURCE* Resource::GetAs() { \ - return As##RESOURCE(); \ +#define DEFINE_RESOURCE_CAST(RESOURCE) \ + template <> \ + inline thunk::RESOURCE* Resource::GetAs() { \ + return As##RESOURCE(); \ } FOR_ALL_PPAPI_RESOURCE_APIS(DEFINE_RESOURCE_CAST) #undef DEFINE_RESOURCE_CAST diff --git a/ppapi/shared_impl/resource_tracker.cc b/ppapi/shared_impl/resource_tracker.cc index 36aa2e1..9b15184 100644 --- a/ppapi/shared_impl/resource_tracker.cc +++ b/ppapi/shared_impl/resource_tracker.cc @@ -16,14 +16,12 @@ namespace ppapi { ResourceTracker::ResourceTracker(ThreadMode thread_mode) - : last_resource_value_(0), - weak_ptr_factory_(this) { + : last_resource_value_(0), weak_ptr_factory_(this) { if (thread_mode == SINGLE_THREADED) thread_checker_.reset(new base::ThreadChecker); } -ResourceTracker::~ResourceTracker() { -} +ResourceTracker::~ResourceTracker() {} void ResourceTracker::CheckThreadingPreconditions() const { DCHECK(!thread_checker_ || thread_checker_->CalledOnValidThread()); @@ -202,7 +200,7 @@ PP_Resource ResourceTracker::AddResource(Resource* object) { // could happen for OOP plugins where due to reentrancies in context of // outgoing sync calls the renderer can send events after a plugin has // exited. - DLOG(INFO) << "Failed to find plugin instance in instance map"; + VLOG(1) << "Failed to find plugin instance in instance map"; return 0; } found->second->resources.insert(new_id); @@ -267,7 +265,6 @@ bool ResourceTracker::CanOperateOnResource(PP_Resource res) { // same as that of |last_resource_value_|. return ((res >> kPPIdTypeBits) & 1) == (last_resource_value_ & 1); #endif - } } // namespace ppapi diff --git a/ppapi/shared_impl/resource_tracker_unittest.cc b/ppapi/shared_impl/resource_tracker_unittest.cc index 3c7f901..d2b53ac 100644 --- a/ppapi/shared_impl/resource_tracker_unittest.cc +++ b/ppapi/shared_impl/resource_tracker_unittest.cc @@ -23,16 +23,12 @@ class MyMockResource : public Resource { MyMockResource(PP_Instance instance) : Resource(OBJECT_IS_IMPL, instance) { mock_resource_alive_count++; } - virtual ~MyMockResource() { - mock_resource_alive_count--; - } + virtual ~MyMockResource() { mock_resource_alive_count--; } virtual void LastPluginRefWasDeleted() OVERRIDE { last_plugin_ref_was_deleted_count++; } - virtual void InstanceWasDeleted() OVERRIDE { - instance_was_deleted_count++; - } + virtual void InstanceWasDeleted() OVERRIDE { instance_was_deleted_count++; } }; } // namespace @@ -47,8 +43,7 @@ class ResourceTrackerTest : public testing::Test { last_plugin_ref_was_deleted_count = 0; instance_was_deleted_count = 0; } - virtual void TearDown() OVERRIDE { - } + virtual void TearDown() OVERRIDE {} ResourceTracker& resource_tracker() { return *globals_.GetResourceTracker(); } diff --git a/ppapi/shared_impl/resource_var.cc b/ppapi/shared_impl/resource_var.cc index 1260843..40d9e35 100644 --- a/ppapi/shared_impl/resource_var.cc +++ b/ppapi/shared_impl/resource_var.cc @@ -9,25 +9,15 @@ namespace ppapi { -int ResourceVar::GetPendingRendererHostId() const { - return 0; -} +int ResourceVar::GetPendingRendererHostId() const { return 0; } -int ResourceVar::GetPendingBrowserHostId() const { - return 0; -} +int ResourceVar::GetPendingBrowserHostId() const { return 0; } -const IPC::Message* ResourceVar::GetCreationMessage() const { - return NULL; -} +const IPC::Message* ResourceVar::GetCreationMessage() const { return NULL; } -ResourceVar* ResourceVar::AsResourceVar() { - return this; -} +ResourceVar* ResourceVar::AsResourceVar() { return this; } -PP_VarType ResourceVar::GetType() const { - return PP_VARTYPE_RESOURCE; -} +PP_VarType ResourceVar::GetType() const { return PP_VARTYPE_RESOURCE; } // static ResourceVar* ResourceVar::FromPPVar(PP_Var var) { diff --git a/ppapi/shared_impl/scoped_pp_resource.cc b/ppapi/shared_impl/scoped_pp_resource.cc index 45a1ad7..b842b56 100644 --- a/ppapi/shared_impl/scoped_pp_resource.cc +++ b/ppapi/shared_impl/scoped_pp_resource.cc @@ -10,16 +10,14 @@ namespace ppapi { -ScopedPPResource::ScopedPPResource() : id_(0) { -} +ScopedPPResource::ScopedPPResource() : id_(0) {} ScopedPPResource::ScopedPPResource(PP_Resource resource) : id_(resource) { CallAddRef(); } ScopedPPResource::ScopedPPResource(const PassRef&, PP_Resource resource) - : id_(resource) { -} + : id_(resource) {} ScopedPPResource::ScopedPPResource(Resource* resource) : id_(resource ? resource->GetReference() : 0) { @@ -31,9 +29,7 @@ ScopedPPResource::ScopedPPResource(const ScopedPPResource& other) CallAddRef(); } -ScopedPPResource::~ScopedPPResource() { - CallRelease(); -} +ScopedPPResource::~ScopedPPResource() { CallRelease(); } ScopedPPResource& ScopedPPResource::operator=(PP_Resource resource) { if (id_ == resource) diff --git a/ppapi/shared_impl/scoped_pp_var.cc b/ppapi/shared_impl/scoped_pp_var.cc index 3ae13b0..f612aa1 100644 --- a/ppapi/shared_impl/scoped_pp_var.cc +++ b/ppapi/shared_impl/scoped_pp_var.cc @@ -21,24 +21,17 @@ void CallRelease(const PP_Var& v) { } // namespace -ScopedPPVar::ScopedPPVar() : var_(PP_MakeUndefined()) { -} +ScopedPPVar::ScopedPPVar() : var_(PP_MakeUndefined()) {} -ScopedPPVar::ScopedPPVar(const PP_Var& v) : var_(v) { - CallAddRef(var_); -} +ScopedPPVar::ScopedPPVar(const PP_Var& v) : var_(v) { CallAddRef(var_); } -ScopedPPVar::ScopedPPVar(const PassRef&, const PP_Var& v) : var_(v) { -} +ScopedPPVar::ScopedPPVar(const PassRef&, const PP_Var& v) : var_(v) {} -ScopedPPVar::ScopedPPVar(const ScopedPPVar& other) - : var_(other.var_) { +ScopedPPVar::ScopedPPVar(const ScopedPPVar& other) : var_(other.var_) { CallAddRef(var_); } -ScopedPPVar::~ScopedPPVar() { - CallRelease(var_); -} +ScopedPPVar::~ScopedPPVar() { CallRelease(var_); } ScopedPPVar& ScopedPPVar::operator=(const PP_Var& v) { CallAddRef(v); diff --git a/ppapi/shared_impl/socket_option_data.cc b/ppapi/shared_impl/socket_option_data.cc index e45bb25..27e66a2 100644 --- a/ppapi/shared_impl/socket_option_data.cc +++ b/ppapi/shared_impl/socket_option_data.cc @@ -6,15 +6,11 @@ namespace ppapi { -SocketOptionData::SocketOptionData() : type_(TYPE_INVALID), value_(0) { -} +SocketOptionData::SocketOptionData() : type_(TYPE_INVALID), value_(0) {} -SocketOptionData::~SocketOptionData() { -} +SocketOptionData::~SocketOptionData() {} -SocketOptionData::Type SocketOptionData::GetType() const { - return type_; -} +SocketOptionData::Type SocketOptionData::GetType() const { return type_; } bool SocketOptionData::GetBool(bool* out_value) const { if (!out_value || type_ != TYPE_BOOL) diff --git a/ppapi/shared_impl/socket_option_data.h b/ppapi/shared_impl/socket_option_data.h index ec754a9..2c88454 100644 --- a/ppapi/shared_impl/socket_option_data.h +++ b/ppapi/shared_impl/socket_option_data.h @@ -12,11 +12,7 @@ namespace ppapi { class PPAPI_SHARED_EXPORT SocketOptionData { public: - enum Type { - TYPE_INVALID = 0, - TYPE_BOOL = 1, - TYPE_INT32 = 2 - }; + enum Type { TYPE_INVALID = 0, TYPE_BOOL = 1, TYPE_INT32 = 2 }; SocketOptionData(); ~SocketOptionData(); diff --git a/ppapi/shared_impl/test_globals.cc b/ppapi/shared_impl/test_globals.cc index 2739e26..d640997 100644 --- a/ppapi/shared_impl/test_globals.cc +++ b/ppapi/shared_impl/test_globals.cc @@ -9,33 +9,27 @@ namespace ppapi { TestGlobals::TestGlobals() : ppapi::PpapiGlobals(), resource_tracker_(ResourceTracker::THREAD_SAFE), - callback_tracker_(new CallbackTracker) { -} + callback_tracker_(new CallbackTracker) {} TestGlobals::TestGlobals(PpapiGlobals::PerThreadForTest per_thread_for_test) : ppapi::PpapiGlobals(per_thread_for_test), resource_tracker_(ResourceTracker::THREAD_SAFE), - callback_tracker_(new CallbackTracker) { -} + callback_tracker_(new CallbackTracker) {} -TestGlobals::~TestGlobals() { -} +TestGlobals::~TestGlobals() {} ResourceTracker* TestGlobals::GetResourceTracker() { return &resource_tracker_; } -VarTracker* TestGlobals::GetVarTracker() { - return &var_tracker_; -} +VarTracker* TestGlobals::GetVarTracker() { return &var_tracker_; } CallbackTracker* TestGlobals::GetCallbackTrackerForInstance( PP_Instance instance) { return callback_tracker_.get(); } -thunk::PPB_Instance_API* TestGlobals::GetInstanceAPI( - PP_Instance instance) { +thunk::PPB_Instance_API* TestGlobals::GetInstanceAPI(PP_Instance instance) { return NULL; } @@ -44,36 +38,25 @@ thunk::ResourceCreationAPI* TestGlobals::GetResourceCreationAPI( return NULL; } -PP_Module TestGlobals::GetModuleForInstance(PP_Instance instance) { - return 0; -} +PP_Module TestGlobals::GetModuleForInstance(PP_Instance instance) { return 0; } -std::string TestGlobals::GetCmdLine() { - return std::string(); -} +std::string TestGlobals::GetCmdLine() { return std::string(); } -void TestGlobals::PreCacheFontForFlash(const void* /* logfontw */) { -} +void TestGlobals::PreCacheFontForFlash(const void* /* logfontw */) {} void TestGlobals::LogWithSource(PP_Instance instance, PP_LogLevel level, const std::string& source, - const std::string& value) { -} + const std::string& value) {} void TestGlobals::BroadcastLogWithSource(PP_Module module, PP_LogLevel level, const std::string& source, - const std::string& value) { -} + const std::string& value) {} -MessageLoopShared* TestGlobals::GetCurrentMessageLoop() { - return NULL; -} +MessageLoopShared* TestGlobals::GetCurrentMessageLoop() { return NULL; } -base::TaskRunner* TestGlobals::GetFileTaskRunner() { - return NULL; -} +base::TaskRunner* TestGlobals::GetFileTaskRunner() { return NULL; } bool TestGlobals::IsHostGlobals() const { // Pretend to be the host-side, for code that expects one or the other. diff --git a/ppapi/shared_impl/test_globals.h b/ppapi/shared_impl/test_globals.h index 2b4b5cb..dbc62b9 100644 --- a/ppapi/shared_impl/test_globals.h +++ b/ppapi/shared_impl/test_globals.h @@ -31,13 +31,12 @@ class TestVarTracker : public VarTracker { virtual ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) OVERRIDE { return NULL; } - virtual ArrayBufferVar* CreateShmArrayBuffer( - uint32 size_in_bytes, - base::SharedMemoryHandle handle) OVERRIDE { + virtual ArrayBufferVar* CreateShmArrayBuffer(uint32 size_in_bytes, + base::SharedMemoryHandle handle) + OVERRIDE { return NULL; } - virtual void DidDeleteInstance(PP_Instance instance) OVERRIDE { - } + virtual void DidDeleteInstance(PP_Instance instance) OVERRIDE {} virtual int TrackSharedMemoryHandle(PP_Instance instance, base::SharedMemoryHandle handle, uint32 size_in_bytes) OVERRIDE { @@ -62,10 +61,10 @@ class TestGlobals : public PpapiGlobals { // PpapiGlobals implementation. virtual ResourceTracker* GetResourceTracker() OVERRIDE; virtual VarTracker* GetVarTracker() OVERRIDE; - virtual CallbackTracker* GetCallbackTrackerForInstance( - PP_Instance instance) OVERRIDE; - virtual thunk::PPB_Instance_API* GetInstanceAPI( - PP_Instance instance) OVERRIDE; + virtual CallbackTracker* GetCallbackTrackerForInstance(PP_Instance instance) + OVERRIDE; + virtual thunk::PPB_Instance_API* GetInstanceAPI(PP_Instance instance) + OVERRIDE; virtual thunk::ResourceCreationAPI* GetResourceCreationAPI( PP_Instance instance) OVERRIDE; virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE; @@ -95,4 +94,4 @@ class TestGlobals : public PpapiGlobals { } // namespace ppapi -#endif // PPAPI_SHARED_IMPL_TEST_GLOBALS_H_ +#endif // PPAPI_SHARED_IMPL_TEST_GLOBALS_H_ diff --git a/ppapi/shared_impl/thread_aware_callback.cc b/ppapi/shared_impl/thread_aware_callback.cc index 06e722a..4739a94 100644 --- a/ppapi/shared_impl/thread_aware_callback.cc +++ b/ppapi/shared_impl/thread_aware_callback.cc @@ -14,8 +14,7 @@ namespace internal { class ThreadAwareCallbackBase::Core : public base::RefCountedThreadSafe<Core> { public: - Core() : aborted_(false) { - } + Core() : aborted_(false) {} void MarkAsAborted() { aborted_ = true; } @@ -26,8 +25,7 @@ class ThreadAwareCallbackBase::Core : public base::RefCountedThreadSafe<Core> { private: friend class base::RefCountedThreadSafe<Core>; - ~Core() { - } + ~Core() {} bool aborted_; }; @@ -38,9 +36,7 @@ ThreadAwareCallbackBase::ThreadAwareCallbackBase() DCHECK(target_loop_.get()); } -ThreadAwareCallbackBase::~ThreadAwareCallbackBase() { - core_->MarkAsAborted(); -} +ThreadAwareCallbackBase::~ThreadAwareCallbackBase() { core_->MarkAsAborted(); } // static bool ThreadAwareCallbackBase::HasTargetLoop() { diff --git a/ppapi/shared_impl/thread_aware_callback.h b/ppapi/shared_impl/thread_aware_callback.h index b954eec..92284678 100644 --- a/ppapi/shared_impl/thread_aware_callback.h +++ b/ppapi/shared_impl/thread_aware_callback.h @@ -64,12 +64,9 @@ class ThreadAwareCallback : public internal::ThreadAwareCallbackBase { return new ThreadAwareCallback(func); } - ~ThreadAwareCallback() { - } + ~ThreadAwareCallback() {} - void RunOnTargetThread() { - InternalRunOnTargetThread(base::Bind(func_)); - } + void RunOnTargetThread() { InternalRunOnTargetThread(base::Bind(func_)); } template <class P1> void RunOnTargetThread(const P1& p1) { @@ -104,8 +101,7 @@ class ThreadAwareCallback : public internal::ThreadAwareCallbackBase { } private: - explicit ThreadAwareCallback(FuncType func) : func_(func) { - } + explicit ThreadAwareCallback(FuncType func) : func_(func) {} FuncType func_; }; diff --git a/ppapi/shared_impl/thread_aware_callback_unittest.cc b/ppapi/shared_impl/thread_aware_callback_unittest.cc index f86048a7..5173753 100644 --- a/ppapi/shared_impl/thread_aware_callback_unittest.cc +++ b/ppapi/shared_impl/thread_aware_callback_unittest.cc @@ -18,29 +18,20 @@ namespace { class TestParameter { public: - TestParameter() : value_(0) { - } + TestParameter() : value_(0) {} int value_; }; int called_num = 0; -void TestCallback_0() { - ++called_num; -} +void TestCallback_0() { ++called_num; } -void TestCallback_1(int p1) { - ++called_num; -} +void TestCallback_1(int p1) { ++called_num; } -void TestCallback_2(int p1, const double* p2) { - ++called_num; -} +void TestCallback_2(int p1, const double* p2) { ++called_num; } -void TestCallback_3(int p1, const double* p2, bool* p3) { - ++called_num; -} +void TestCallback_3(int p1, const double* p2, bool* p3) { ++called_num; } void TestCallback_4(int p1, const double* p2, bool* p3, TestParameter p4) { ++called_num; @@ -61,8 +52,7 @@ typedef proxy::PluginProxyTest ThreadAwareCallbackTest; class ThreadAwareCallbackMultiThreadTest : public proxy::PluginProxyMultiThreadTest { public: - ThreadAwareCallbackMultiThreadTest() : main_thread_callback_called_(false) { - } + ThreadAwareCallbackMultiThreadTest() : main_thread_callback_called_(false) {} virtual ~ThreadAwareCallbackMultiThreadTest() { CHECK(main_thread_callback_called_); } @@ -109,10 +99,8 @@ class ThreadAwareCallbackMultiThreadTest // run the callback will be ignored. class ThreadAwareCallbackAbortTest : public proxy::PluginProxyMultiThreadTest { public: - ThreadAwareCallbackAbortTest() { - } - virtual ~ThreadAwareCallbackAbortTest() { - } + ThreadAwareCallbackAbortTest() {} + virtual ~ThreadAwareCallbackAbortTest() {} // proxy::PluginProxyMultiThreadTest implementation. virtual void SetUpTestOnMainThread() OVERRIDE { @@ -194,25 +182,18 @@ TEST_F(ThreadAwareCallbackTest, Basics) { ThreadAwareCallback<FuncType_4>::Create(TestCallback_4)); callback_4->RunOnTargetThread(1, &double_arg, &bool_arg, object_arg); - typedef void (*FuncType_5)(int, - const double*, - bool*, - TestParameter, - const TestParameter&); + typedef void (*FuncType_5)( + int, const double*, bool*, TestParameter, const TestParameter&); scoped_ptr<ThreadAwareCallback<FuncType_5> > callback_5( ThreadAwareCallback<FuncType_5>::Create(TestCallback_5)); - callback_5->RunOnTargetThread(1, &double_arg, &bool_arg, object_arg, - object_arg); + callback_5->RunOnTargetThread( + 1, &double_arg, &bool_arg, object_arg, object_arg); EXPECT_EQ(6, called_num); } -TEST_F(ThreadAwareCallbackMultiThreadTest, RunOnTargetThread) { - RunTest(); -} +TEST_F(ThreadAwareCallbackMultiThreadTest, RunOnTargetThread) { RunTest(); } -TEST_F(ThreadAwareCallbackAbortTest, NotRunIfAborted) { - RunTest(); -} +TEST_F(ThreadAwareCallbackAbortTest, NotRunIfAborted) { RunTest(); } } // namespace ppapi diff --git a/ppapi/shared_impl/time_conversion.cc b/ppapi/shared_impl/time_conversion.cc index 27ea494..8da1483 100644 --- a/ppapi/shared_impl/time_conversion.cc +++ b/ppapi/shared_impl/time_conversion.cc @@ -25,9 +25,7 @@ double GetTimeToTimeTicksDeltaInSeconds() { } // namespace -PP_Time TimeToPPTime(base::Time t) { - return t.ToDoubleT(); -} +PP_Time TimeToPPTime(base::Time t) { return t.ToDoubleT(); } base::Time PPTimeToTime(PP_Time t) { // The time code handles exact "0" values as special, and produces @@ -41,7 +39,7 @@ base::Time PPTimeToTime(PP_Time t) { PP_TimeTicks TimeTicksToPPTimeTicks(base::TimeTicks t) { return static_cast<double>(t.ToInternalValue()) / - base::Time::kMicrosecondsPerSecond; + base::Time::kMicrosecondsPerSecond; } PP_TimeTicks EventTimeToPPTimeTicks(double event_time) { @@ -56,8 +54,8 @@ double PPGetLocalTimeZoneOffset(const base::Time& time) { // Explode it to local time and then unexplode it as if it were UTC. Also // explode it to UTC and unexplode it (this avoids mismatching rounding or // lack thereof). The time zone offset is their difference. - base::Time::Exploded exploded = { 0 }; - base::Time::Exploded utc_exploded = { 0 }; + base::Time::Exploded exploded = {0}; + base::Time::Exploded utc_exploded = {0}; time.LocalExplode(&exploded); time.UTCExplode(&utc_exploded); if (exploded.HasValidValues() && utc_exploded.HasValidValues()) { diff --git a/ppapi/shared_impl/tracked_callback.cc b/ppapi/shared_impl/tracked_callback.cc index f3b8bb9..70565a1 100644 --- a/ppapi/shared_impl/tracked_callback.cc +++ b/ppapi/shared_impl/tracked_callback.cc @@ -23,8 +23,9 @@ namespace ppapi { namespace { bool IsMainThread() { - return - PpapiGlobals::Get()->GetMainThreadMessageLoop()->BelongsToCurrentThread(); + return PpapiGlobals::Get() + ->GetMainThreadMessageLoop() + ->BelongsToCurrentThread(); } int32_t RunCompletionTask(TrackedCallback::CompletionTask completion_task, @@ -40,9 +41,8 @@ int32_t RunCompletionTask(TrackedCallback::CompletionTask completion_task, // TrackedCallback ------------------------------------------------------------- // Note: don't keep a Resource* since it may go out of scope before us. -TrackedCallback::TrackedCallback( - Resource* resource, - const PP_CompletionCallback& callback) +TrackedCallback::TrackedCallback(Resource* resource, + const PP_CompletionCallback& callback) : is_scheduled_(false), resource_id_(resource ? resource->pp_resource() : 0), completed_(false), @@ -80,16 +80,11 @@ TrackedCallback::TrackedCallback( } } -TrackedCallback::~TrackedCallback() { -} +TrackedCallback::~TrackedCallback() {} -void TrackedCallback::Abort() { - Run(PP_ERROR_ABORTED); -} +void TrackedCallback::Abort() { Run(PP_ERROR_ABORTED); } -void TrackedCallback::PostAbort() { - PostRun(PP_ERROR_ABORTED); -} +void TrackedCallback::PostAbort() { PostRun(PP_ERROR_ABORTED); } void TrackedCallback::Run(int32_t result) { // Only allow the callback to be run once. Note that this also covers the case diff --git a/ppapi/shared_impl/tracked_callback.h b/ppapi/shared_impl/tracked_callback.h index c8b6c01..294c9b9 100644 --- a/ppapi/shared_impl/tracked_callback.h +++ b/ppapi/shared_impl/tracked_callback.h @@ -109,13 +109,9 @@ class PPAPI_SHARED_EXPORT TrackedCallback bool aborted() const { return aborted_; } // Returns true if this is a blocking callback. - bool is_blocking() { - return !callback_.func; - } + bool is_blocking() { return !callback_.func; } - MessageLoopShared* target_loop() const { - return target_loop_.get(); - } + MessageLoopShared* target_loop() const { return target_loop_.get(); } // Determines if the given callback is pending. A callback is pending if it // has not completed and has not been aborted. When receiving a plugin call, diff --git a/ppapi/shared_impl/tracked_callback_unittest.cc b/ppapi/shared_impl/tracked_callback_unittest.cc index 6a7376b..cd787f8 100644 --- a/ppapi/shared_impl/tracked_callback_unittest.cc +++ b/ppapi/shared_impl/tracked_callback_unittest.cc @@ -78,7 +78,7 @@ class CallbackShutdownTest : public TrackedCallbackTest { // (1) A callback which is run (so shouldn't be aborted on shutdown). // (2) A callback which is aborted (so shouldn't be aborted on shutdown). // (3) A callback which isn't run (so should be aborted on shutdown). - CallbackRunInfo& info_did_run() { return info_did_run_; } // (1) + CallbackRunInfo& info_did_run() { return info_did_run_; } // (1) CallbackRunInfo& info_did_abort() { return info_did_abort_; } // (2) CallbackRunInfo& info_didnt_run() { return info_didnt_run_; } // (3) @@ -155,8 +155,7 @@ class CallbackMockResource : public Resource { EXPECT_NE(0, resource_id); callback_did_run_ = new TrackedCallback( - this, - PP_MakeCompletionCallback(&TestCallback, &info_did_run_)); + this, PP_MakeCompletionCallback(&TestCallback, &info_did_run_)); EXPECT_EQ(0U, info_did_run_.run_count); EXPECT_EQ(0U, info_did_run_.completion_task_run_count); @@ -167,22 +166,21 @@ class CallbackMockResource : public Resource { PP_MakeCompletionCallback(&TestCallback, &info_did_run_with_completion_task_)); callback_did_run_with_completion_task_->set_completion_task( - Bind(&CallbackMockResource::CompletionTask, this, + Bind(&CallbackMockResource::CompletionTask, + this, &info_did_run_with_completion_task_)); EXPECT_EQ(0U, info_did_run_with_completion_task_.run_count); EXPECT_EQ(0U, info_did_run_with_completion_task_.completion_task_run_count); callback_did_abort_ = new TrackedCallback( - this, - PP_MakeCompletionCallback(&TestCallback, &info_did_abort_)); + this, PP_MakeCompletionCallback(&TestCallback, &info_did_abort_)); callback_did_abort_->set_completion_task( Bind(&CallbackMockResource::CompletionTask, this, &info_did_abort_)); EXPECT_EQ(0U, info_did_abort_.run_count); EXPECT_EQ(0U, info_did_abort_.completion_task_run_count); callback_didnt_run_ = new TrackedCallback( - this, - PP_MakeCompletionCallback(&TestCallback, &info_didnt_run_)); + this, PP_MakeCompletionCallback(&TestCallback, &info_didnt_run_)); callback_didnt_run_->set_completion_task( Bind(&CallbackMockResource::CompletionTask, this, &info_didnt_run_)); EXPECT_EQ(0U, info_didnt_run_.run_count); @@ -215,8 +213,7 @@ class CallbackMockResource : public Resource { // completion task should override the result. EXPECT_EQ(kOverrideResultValue, info_did_run_with_completion_task_.result); EXPECT_EQ(1U, info_did_run_with_completion_task_.completion_task_run_count); - EXPECT_EQ(PP_OK, - info_did_run_with_completion_task_.completion_task_result); + EXPECT_EQ(PP_OK, info_did_run_with_completion_task_.completion_task_result); EXPECT_EQ(1U, info_did_abort_.run_count); // completion task shouldn't override an abort. @@ -255,8 +252,7 @@ class CallbackMockResource : public Resource { // Test that callbacks get aborted on the last resource unref. TEST_F(CallbackResourceTest, AbortOnNoRef) { ProxyAutoLock lock; - ResourceTracker* resource_tracker = - PpapiGlobals::Get()->GetResourceTracker(); + ResourceTracker* resource_tracker = PpapiGlobals::Get()->GetResourceTracker(); // Test several things: Unref-ing a resource (to zero refs) with callbacks // which (1) have been run, (2) have been aborted, (3) haven't been completed. @@ -305,8 +301,7 @@ TEST_F(CallbackResourceTest, AbortOnNoRef) { // doesn't resurrect callbacks. TEST_F(CallbackResourceTest, Resurrection) { ProxyAutoLock lock; - ResourceTracker* resource_tracker = - PpapiGlobals::Get()->GetResourceTracker(); + ResourceTracker* resource_tracker = PpapiGlobals::Get()->GetResourceTracker(); scoped_refptr<CallbackMockResource> resource( new CallbackMockResource(pp_instance())); diff --git a/ppapi/shared_impl/unittest_utils.cc b/ppapi/shared_impl/unittest_utils.cc index 6974bd2..a52db34 100644 --- a/ppapi/shared_impl/unittest_utils.cc +++ b/ppapi/shared_impl/unittest_utils.cc @@ -27,8 +27,8 @@ bool Equals(const PP_Var& expected, const PP_Var& actual, base::hash_map<int64_t, int64_t>* visited_map) { if (expected.type != actual.type) { - LOG(ERROR) << "expected type: " << expected.type << - " actual type: " << actual.type; + LOG(ERROR) << "expected type: " << expected.type + << " actual type: " << actual.type; return false; } if (VarTracker::IsVarTypeRefcounted(expected.type)) { @@ -36,8 +36,8 @@ bool Equals(const PP_Var& expected, visited_map->find(expected.value.as_id); if (it != visited_map->end()) { if (it->second != actual.value.as_id) { - LOG(ERROR) << "expected id: " << it->second << " actual id: " << - actual.value.as_id; + LOG(ERROR) << "expected id: " << it->second + << " actual id: " << actual.value.as_id; return false; } else { return true; @@ -53,29 +53,29 @@ bool Equals(const PP_Var& expected, return true; case PP_VARTYPE_BOOL: if (expected.value.as_bool != actual.value.as_bool) { - LOG(ERROR) << "expected: " << expected.value.as_bool << " actual: " << - actual.value.as_bool; + LOG(ERROR) << "expected: " << expected.value.as_bool + << " actual: " << actual.value.as_bool; return false; } return true; case PP_VARTYPE_INT32: if (expected.value.as_int != actual.value.as_int) { - LOG(ERROR) << "expected: " << expected.value.as_int << " actual: " << - actual.value.as_int; + LOG(ERROR) << "expected: " << expected.value.as_int + << " actual: " << actual.value.as_int; return false; } return true; case PP_VARTYPE_DOUBLE: if (fabs(expected.value.as_double - actual.value.as_double) > 1.0e-4) { - LOG(ERROR) << "expected: " << expected.value.as_double << - " actual: " << actual.value.as_double; + LOG(ERROR) << "expected: " << expected.value.as_double + << " actual: " << actual.value.as_double; return false; } return true; case PP_VARTYPE_OBJECT: if (expected.value.as_id != actual.value.as_id) { - LOG(ERROR) << "expected: " << expected.value.as_id << " actual: " << - actual.value.as_id; + LOG(ERROR) << "expected: " << expected.value.as_id + << " actual: " << actual.value.as_id; return false; } return true; @@ -84,8 +84,8 @@ bool Equals(const PP_Var& expected, StringVar* actual_var = StringVar::FromPPVar(actual); DCHECK(expected_var && actual_var); if (expected_var->value() != actual_var->value()) { - LOG(ERROR) << "expected: " << expected_var->value() << " actual: " << - actual_var->value(); + LOG(ERROR) << "expected: " << expected_var->value() + << " actual: " << actual_var->value(); return false; } return true; @@ -95,11 +95,12 @@ bool Equals(const PP_Var& expected, ArrayBufferVar* actual_var = ArrayBufferVar::FromPPVar(actual); DCHECK(expected_var && actual_var); if (expected_var->ByteLength() != actual_var->ByteLength()) { - LOG(ERROR) << "expected: " << expected_var->ByteLength() << - " actual: " << actual_var->ByteLength(); + LOG(ERROR) << "expected: " << expected_var->ByteLength() + << " actual: " << actual_var->ByteLength(); return false; } - if (memcmp(expected_var->Map(), actual_var->Map(), + if (memcmp(expected_var->Map(), + actual_var->Map(), expected_var->ByteLength()) != 0) { LOG(ERROR) << "expected array buffer does not match actual."; return false; @@ -111,8 +112,8 @@ bool Equals(const PP_Var& expected, ArrayVar* actual_var = ArrayVar::FromPPVar(actual); DCHECK(expected_var && actual_var); if (expected_var->elements().size() != actual_var->elements().size()) { - LOG(ERROR) << "expected: " << expected_var->elements().size() << - " actual: " << actual_var->elements().size(); + LOG(ERROR) << "expected: " << expected_var->elements().size() + << " actual: " << actual_var->elements().size(); return false; } for (size_t i = 0; i < expected_var->elements().size(); ++i) { @@ -130,19 +131,19 @@ bool Equals(const PP_Var& expected, DCHECK(expected_var && actual_var); if (expected_var->key_value_map().size() != actual_var->key_value_map().size()) { - LOG(ERROR) << "expected: " << expected_var->key_value_map().size() << - " actual: " << actual_var->key_value_map().size(); + LOG(ERROR) << "expected: " << expected_var->key_value_map().size() + << " actual: " << actual_var->key_value_map().size(); return false; } DictionaryVar::KeyValueMap::const_iterator expected_iter = expected_var->key_value_map().begin(); DictionaryVar::KeyValueMap::const_iterator actual_iter = actual_var->key_value_map().begin(); - for ( ; expected_iter != expected_var->key_value_map().end(); + for (; expected_iter != expected_var->key_value_map().end(); ++expected_iter, ++actual_iter) { if (expected_iter->first != actual_iter->first) { - LOG(ERROR) << "expected: " << expected_iter->first << - " actual: " << actual_iter->first; + LOG(ERROR) << "expected: " << expected_iter->first + << " actual: " << actual_iter->first; return false; } if (!Equals(expected_iter->second.get(), @@ -164,12 +165,11 @@ bool Equals(const PP_Var& expected, } const IPC::Message* actual_message = actual_var->GetCreationMessage(); - const IPC::Message* expected_message = - expected_var->GetCreationMessage(); + const IPC::Message* expected_message = expected_var->GetCreationMessage(); if (expected_message->size() != actual_message->size()) { LOG(ERROR) << "expected creation message size: " - << expected_message->size() << " actual: " - << actual_message->size(); + << expected_message->size() + << " actual: " << actual_message->size(); return false; } @@ -179,10 +179,12 @@ bool Equals(const PP_Var& expected, // the comparison to fail. IPC::Message local_actual_message(*actual_message); local_actual_message.SetHeaderValues( - actual_message->routing_id(), actual_message->type(), + actual_message->routing_id(), + actual_message->type(), (expected_message->flags() & 0xffffff00) | - (actual_message->flags() & 0xff)); - if (memcmp(expected_message->data(), local_actual_message.data(), + (actual_message->flags() & 0xff)); + if (memcmp(expected_message->data(), + local_actual_message.data(), expected_message->size()) != 0) { LOG(ERROR) << "expected creation message does not match actual."; return false; diff --git a/ppapi/shared_impl/url_request_info_data.cc b/ppapi/shared_impl/url_request_info_data.cc index 15b2787..bb77a43 100644 --- a/ppapi/shared_impl/url_request_info_data.cc +++ b/ppapi/shared_impl/url_request_info_data.cc @@ -20,8 +20,7 @@ URLRequestInfoData::BodyItem::BodyItem() file_ref_pp_resource(0), start_offset(0), number_of_bytes(-1), - expected_last_modified_time(0.0) { -} + expected_last_modified_time(0.0) {} URLRequestInfoData::BodyItem::BodyItem(const std::string& data) : is_file(false), @@ -29,21 +28,18 @@ URLRequestInfoData::BodyItem::BodyItem(const std::string& data) file_ref_pp_resource(0), start_offset(0), number_of_bytes(-1), - expected_last_modified_time(0.0) { -} + expected_last_modified_time(0.0) {} -URLRequestInfoData::BodyItem::BodyItem( - Resource* file_ref, - int64_t start_offset, - int64_t number_of_bytes, - PP_Time expected_last_modified_time) +URLRequestInfoData::BodyItem::BodyItem(Resource* file_ref, + int64_t start_offset, + int64_t number_of_bytes, + PP_Time expected_last_modified_time) : is_file(true), file_ref_resource(file_ref), file_ref_pp_resource(file_ref->pp_resource()), start_offset(start_offset), number_of_bytes(number_of_bytes), - expected_last_modified_time(expected_last_modified_time) { -} + expected_last_modified_time(expected_last_modified_time) {} URLRequestInfoData::URLRequestInfoData() : url(), @@ -63,10 +59,8 @@ URLRequestInfoData::URLRequestInfoData() custom_user_agent(), prefetch_buffer_upper_threshold(kDefaultPrefetchBufferUpperThreshold), prefetch_buffer_lower_threshold(kDefaultPrefetchBufferLowerThreshold), - body() { -} + body() {} -URLRequestInfoData::~URLRequestInfoData() { -} +URLRequestInfoData::~URLRequestInfoData() {} } // namespace ppapi diff --git a/ppapi/shared_impl/url_response_info_data.cc b/ppapi/shared_impl/url_response_info_data.cc index 0b4b078..5fc41e5 100644 --- a/ppapi/shared_impl/url_response_info_data.cc +++ b/ppapi/shared_impl/url_response_info_data.cc @@ -6,10 +6,8 @@ namespace ppapi { -URLResponseInfoData::URLResponseInfoData() : status_code(-1) { -} +URLResponseInfoData::URLResponseInfoData() : status_code(-1) {} -URLResponseInfoData::~URLResponseInfoData() { -} +URLResponseInfoData::~URLResponseInfoData() {} } // namespace ppapi diff --git a/ppapi/shared_impl/var.cc b/ppapi/shared_impl/var.cc index 56def19..8f3ddb5 100644 --- a/ppapi/shared_impl/var.cc +++ b/ppapi/shared_impl/var.cc @@ -76,33 +76,19 @@ std::string Var::PPVarToLogString(PP_Var var) { } } -StringVar* Var::AsStringVar() { - return NULL; -} +StringVar* Var::AsStringVar() { return NULL; } -ArrayBufferVar* Var::AsArrayBufferVar() { - return NULL; -} +ArrayBufferVar* Var::AsArrayBufferVar() { return NULL; } -NPObjectVar* Var::AsNPObjectVar() { - return NULL; -} +NPObjectVar* Var::AsNPObjectVar() { return NULL; } -ProxyObjectVar* Var::AsProxyObjectVar() { - return NULL; -} +ProxyObjectVar* Var::AsProxyObjectVar() { return NULL; } -ArrayVar* Var::AsArrayVar() { - return NULL; -} +ArrayVar* Var::AsArrayVar() { return NULL; } -DictionaryVar* Var::AsDictionaryVar() { - return NULL; -} +DictionaryVar* Var::AsDictionaryVar() { return NULL; } -ResourceVar* Var::AsResourceVar() { - return NULL; -} +ResourceVar* Var::AsResourceVar() { return NULL; } PP_Var Var::GetPPVar() { int32 id = GetOrCreateVarID(); @@ -116,15 +102,11 @@ PP_Var Var::GetPPVar() { return result; } -int32 Var::GetExistingVarID() const { - return var_id_; -} +int32 Var::GetExistingVarID() const { return var_id_; } -Var::Var() : var_id_(0) { -} +Var::Var() : var_id_(0) {} -Var::~Var() { -} +Var::~Var() {} int32 Var::GetOrCreateVarID() { VarTracker* tracker = PpapiGlobals::Get()->GetVarTracker(); @@ -146,27 +128,17 @@ void Var::AssignVarID(int32 id) { // StringVar ------------------------------------------------------------------- -StringVar::StringVar() { -} +StringVar::StringVar() {} -StringVar::StringVar(const std::string& str) - : value_(str) { -} +StringVar::StringVar(const std::string& str) : value_(str) {} -StringVar::StringVar(const char* str, uint32 len) - : value_(str, len) { -} +StringVar::StringVar(const char* str, uint32 len) : value_(str, len) {} -StringVar::~StringVar() { -} +StringVar::~StringVar() {} -StringVar* StringVar::AsStringVar() { - return this; -} +StringVar* StringVar::AsStringVar() { return this; } -PP_VarType StringVar::GetType() const { - return PP_VARTYPE_STRING; -} +PP_VarType StringVar::GetType() const { return PP_VARTYPE_STRING; } // static PP_Var StringVar::StringToPPVar(const std::string& var) { @@ -201,19 +173,13 @@ PP_Var StringVar::SwapValidatedUTF8StringIntoPPVar(std::string* src) { // ArrayBufferVar -------------------------------------------------------------- -ArrayBufferVar::ArrayBufferVar() { -} +ArrayBufferVar::ArrayBufferVar() {} -ArrayBufferVar::~ArrayBufferVar() { -} +ArrayBufferVar::~ArrayBufferVar() {} -ArrayBufferVar* ArrayBufferVar::AsArrayBufferVar() { - return this; -} +ArrayBufferVar* ArrayBufferVar::AsArrayBufferVar() { return this; } -PP_VarType ArrayBufferVar::GetType() const { - return PP_VARTYPE_ARRAY_BUFFER; -} +PP_VarType ArrayBufferVar::GetType() const { return PP_VARTYPE_ARRAY_BUFFER; } // static ArrayBufferVar* ArrayBufferVar::FromPPVar(PP_Var var) { @@ -227,4 +193,3 @@ ArrayBufferVar* ArrayBufferVar::FromPPVar(PP_Var var) { } } // namespace ppapi - diff --git a/ppapi/shared_impl/var.h b/ppapi/shared_impl/var.h index a52dc3ac..a8dec33 100644 --- a/ppapi/shared_impl/var.h +++ b/ppapi/shared_impl/var.h @@ -172,10 +172,9 @@ class PPAPI_SHARED_EXPORT ArrayBufferVar : public Var { // // Returns true if creating the shared memory (and copying) is successful, // false otherwise. - virtual bool CopyToNewShmem( - PP_Instance instance, - int *host_shm_handle_id, - base::SharedMemoryHandle *plugin_shm_handle) = 0; + virtual bool CopyToNewShmem(PP_Instance instance, + int* host_shm_handle_id, + base::SharedMemoryHandle* plugin_shm_handle) = 0; // Var override. virtual ArrayBufferVar* AsArrayBufferVar() OVERRIDE; diff --git a/ppapi/shared_impl/var_tracker.cc b/ppapi/shared_impl/var_tracker.cc index bada0ab..7fabb80 100644 --- a/ppapi/shared_impl/var_tracker.cc +++ b/ppapi/shared_impl/var_tracker.cc @@ -19,24 +19,17 @@ namespace ppapi { VarTracker::VarInfo::VarInfo() - : var(), - ref_count(0), - track_with_no_reference_count(0) { -} + : var(), ref_count(0), track_with_no_reference_count(0) {} VarTracker::VarInfo::VarInfo(Var* v, int input_ref_count) - : var(v), - ref_count(input_ref_count), - track_with_no_reference_count(0) { -} + : var(v), ref_count(input_ref_count), track_with_no_reference_count(0) {} VarTracker::VarTracker(ThreadMode thread_mode) : last_var_id_(0) { if (thread_mode == SINGLE_THREADED) thread_checker_.reset(new base::ThreadChecker); } -VarTracker::~VarTracker() { -} +VarTracker::~VarTracker() {} void VarTracker::CheckThreadingPreconditions() const { DCHECK(!thread_checker_ || thread_checker_->CalledOnValidThread()); @@ -151,8 +144,8 @@ int32 VarTracker::AddVarInternal(Var* var, AddVarRefMode mode) { int32 new_id = MakeTypedId(++last_var_id_, PP_ID_TYPE_VAR); std::pair<VarMap::iterator, bool> was_inserted = - live_vars_.insert(std::make_pair(new_id, - VarInfo(var, mode == ADD_VAR_TAKE_ONE_REFERENCE ? 1 : 0))); + live_vars_.insert(std::make_pair( + new_id, VarInfo(var, mode == ADD_VAR_TAKE_ONE_REFERENCE ? 1 : 0))); // We should never insert an ID that already exists. DCHECK(was_inserted.second); @@ -191,8 +184,8 @@ VarTracker::VarMap::iterator VarTracker::GetLiveVar(const PP_Var& var) { return live_vars_.find(static_cast<int32>(var.value.as_id)); } -VarTracker::VarMap::const_iterator VarTracker::GetLiveVar( - const PP_Var& var) const { +VarTracker::VarMap::const_iterator VarTracker::GetLiveVar(const PP_Var& var) + const { return live_vars_.find(static_cast<int32>(var.value.as_id)); } diff --git a/ppapi/shared_impl/var_tracker.h b/ppapi/shared_impl/var_tracker.h index a63c7437..814b58c 100644 --- a/ppapi/shared_impl/var_tracker.h +++ b/ppapi/shared_impl/var_tracker.h @@ -80,8 +80,7 @@ class PPAPI_SHARED_EXPORT VarTracker { PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes, const void* data); // Same as above, but copy the contents of the shared memory in |h| // into the new array buffer. - PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes, - base::SharedMemoryHandle h); + PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes, base::SharedMemoryHandle h); // Create an ArrayBuffer and copy the contents of |data| in to it. The // returned object has 0 reference count in the tracker, and like all @@ -143,11 +142,10 @@ class PPAPI_SHARED_EXPORT VarTracker { // Resolves an "id" generated by TrackSharedMemoryHandle back into // a SharedMemory handle and its size on the host. // Not implemented on the plugin side. - virtual bool StopTrackingSharedMemoryHandle( - int id, - PP_Instance instance, - base::SharedMemoryHandle *handle, - uint32* size_in_bytes) = 0; + virtual bool StopTrackingSharedMemoryHandle(int id, + PP_Instance instance, + base::SharedMemoryHandle* handle, + uint32* size_in_bytes) = 0; protected: struct PPAPI_SHARED_EXPORT VarInfo { diff --git a/ppapi/shared_impl/var_tracker_unittest.cc b/ppapi/shared_impl/var_tracker_unittest.cc index 0fe1a03..1a4a469 100644 --- a/ppapi/shared_impl/var_tracker_unittest.cc +++ b/ppapi/shared_impl/var_tracker_unittest.cc @@ -21,28 +21,16 @@ class MockStringVar : public StringVar { MockStringVar(const std::string& str) : StringVar(str) { mock_var_alive_count++; } - virtual ~MockStringVar() { - mock_var_alive_count--; - } - bool HasValidVarID() { - return GetExistingVarID() != 0; - } + virtual ~MockStringVar() { mock_var_alive_count--; } + bool HasValidVarID() { return GetExistingVarID() != 0; } }; class MockObjectVar : public Var { public: - MockObjectVar() : Var() { - mock_var_alive_count++; - } - virtual ~MockObjectVar() { - mock_var_alive_count--; - } - virtual PP_VarType GetType() const OVERRIDE { - return PP_VARTYPE_OBJECT; - } - bool HasValidVarID() { - return GetExistingVarID() != 0; - } + MockObjectVar() : Var() { mock_var_alive_count++; } + virtual ~MockObjectVar() { mock_var_alive_count--; } + virtual PP_VarType GetType() const OVERRIDE { return PP_VARTYPE_OBJECT; } + bool HasValidVarID() { return GetExistingVarID() != 0; } }; } // namespace @@ -56,8 +44,7 @@ class VarTrackerTest : public testing::Test { ASSERT_EQ(0, mock_var_alive_count); ProxyLock::EnableLockingOnThreadForTest(); } - virtual void TearDown() OVERRIDE { - } + virtual void TearDown() OVERRIDE {} VarTracker& var_tracker() { return *globals_.GetVarTracker(); } diff --git a/ppapi/shared_impl/var_value_conversions.cc b/ppapi/shared_impl/var_value_conversions.cc index e3a5bdd..d5aad57 100644 --- a/ppapi/shared_impl/var_value_conversions.cc +++ b/ppapi/shared_impl/var_value_conversions.cc @@ -30,10 +30,7 @@ namespace { // of array and dictionary vars. VarNode represents elements of that stack. struct VarNode { VarNode(const PP_Var& in_var, base::Value* in_value) - : var(in_var), - value(in_value), - sentinel(false) { - } + : var(in_var), value(in_value), sentinel(false) {} // This object doesn't hold a reference to it. PP_Var var; @@ -50,9 +47,7 @@ struct VarNode { // of list and dictionary values. ValueNode represents elements of that stack. struct ValueNode { ValueNode(const PP_Var& in_var, const base::Value* in_value) - : var(in_var), - value(in_value) { - } + : var(in_var), value(in_value) {} // This object doesn't hold a reference to it. PP_Var var; @@ -95,9 +90,7 @@ bool CreateValueFromVarHelper(const std::set<int64_t>& parent_ids, value->reset(new base::StringValue(string_var->value())); return true; } - case PP_VARTYPE_OBJECT: { - return false; - } + case PP_VARTYPE_OBJECT: { return false; } case PP_VARTYPE_ARRAY: { if (ContainsKey(parent_ids, var.value.as_id)) { // A circular reference is found. @@ -131,9 +124,7 @@ bool CreateValueFromVarHelper(const std::set<int64_t>& parent_ids, value->reset(binary_value); return true; } - case PP_VARTYPE_RESOURCE: { - return false; - } + case PP_VARTYPE_RESOURCE: { return false; } } NOTREACHED(); return false; @@ -259,8 +250,8 @@ base::Value* CreateValueFromVar(const PP_Var& var) { } scoped_ptr<base::Value> child_value; - if (!CreateValueFromVarHelper(parent_ids, iter->second.get(), - &child_value, &state)) { + if (!CreateValueFromVarHelper( + parent_ids, iter->second.get(), &child_value, &state)) { return NULL; } @@ -282,8 +273,8 @@ base::Value* CreateValueFromVar(const PP_Var& var) { iter != array_var->elements().end(); ++iter) { scoped_ptr<base::Value> child_value; - if (!CreateValueFromVarHelper(parent_ids, iter->get(), &child_value, - &state)) { + if (!CreateValueFromVarHelper( + parent_ids, iter->get(), &child_value, &state)) { return NULL; } @@ -314,8 +305,7 @@ PP_Var CreateVarFromValue(const base::Value& value) { static_cast<const base::DictionaryValue*>(top.value); DictionaryVar* dict_var = DictionaryVar::FromPPVar(top.var); DCHECK(dict_var); - for (base::DictionaryValue::Iterator iter(*dict_value); - !iter.IsAtEnd(); + for (base::DictionaryValue::Iterator iter(*dict_value); !iter.IsAtEnd(); iter.Advance()) { ScopedPPVar child_var; if (!CreateVarFromValueHelper(iter.value(), &child_var, &state) || @@ -346,8 +336,7 @@ PP_Var CreateVarFromValue(const base::Value& value) { return root_var.Release(); } -base::ListValue* CreateListValueFromVarVector( - const std::vector<PP_Var>& vars) { +base::ListValue* CreateListValueFromVarVector(const std::vector<PP_Var>& vars) { scoped_ptr<base::ListValue> list_value(new base::ListValue()); for (std::vector<PP_Var>::const_iterator iter = vars.begin(); @@ -371,8 +360,7 @@ bool CreateVarVectorFromListValue(const base::ListValue& list_value, for (base::ListValue::const_iterator iter = list_value.begin(); iter != list_value.end(); ++iter) { - ScopedPPVar child_var(ScopedPPVar::PassRef(), - CreateVarFromValue(**iter)); + ScopedPPVar child_var(ScopedPPVar::PassRef(), CreateVarFromValue(**iter)); if (child_var.get().type == PP_VARTYPE_UNDEFINED) return false; @@ -391,4 +379,3 @@ bool CreateVarVectorFromListValue(const base::ListValue& list_value, } } // namespace ppapi - diff --git a/ppapi/shared_impl/var_value_conversions.h b/ppapi/shared_impl/var_value_conversions.h index b72e7cc..dfbda50 100644 --- a/ppapi/shared_impl/var_value_conversions.h +++ b/ppapi/shared_impl/var_value_conversions.h @@ -53,7 +53,8 @@ PPAPI_SHARED_EXPORT base::ListValue* CreateListValueFromVarVector( // The conversion fails and returns false if any of the calls to // CreateVarFromValue() fails. In that case, |vars| is untouched. PPAPI_SHARED_EXPORT bool CreateVarVectorFromListValue( - const base::ListValue& list_value, std::vector<PP_Var>* vars); + const base::ListValue& list_value, + std::vector<PP_Var>* vars); } // namespace ppapi diff --git a/ppapi/shared_impl/var_value_conversions_unittest.cc b/ppapi/shared_impl/var_value_conversions_unittest.cc index f8a0a31..8a6fc19 100644 --- a/ppapi/shared_impl/var_value_conversions_unittest.cc +++ b/ppapi/shared_impl/var_value_conversions_unittest.cc @@ -33,27 +33,23 @@ bool Equals(const base::Value& value, const PP_Var& var) { } case base::Value::TYPE_BOOLEAN: { bool result = false; - return var.type == PP_VARTYPE_BOOL && - value.GetAsBoolean(&result) && + return var.type == PP_VARTYPE_BOOL && value.GetAsBoolean(&result) && result == PP_ToBool(var.value.as_bool); } case base::Value::TYPE_INTEGER: { int result = 0; - return var.type == PP_VARTYPE_INT32 && - value.GetAsInteger(&result) && + return var.type == PP_VARTYPE_INT32 && value.GetAsInteger(&result) && result == var.value.as_int; } case base::Value::TYPE_DOUBLE: { double result = 0; - return var.type == PP_VARTYPE_DOUBLE && - value.GetAsDouble(&result) && + return var.type == PP_VARTYPE_DOUBLE && value.GetAsDouble(&result) && fabs(result - var.value.as_double) < 1.0e-4; } case base::Value::TYPE_STRING: { std::string result; StringVar* string_var = StringVar::FromPPVar(var); - return string_var && - value.GetAsString(&result) && + return string_var && value.GetAsString(&result) && result == string_var->value(); } case base::Value::TYPE_BINARY: { @@ -65,7 +61,8 @@ bool Equals(const base::Value& value, const PP_Var& var) { return false; } - bool result = !memcmp(binary_value.GetBuffer(), array_buffer_var->Map(), + bool result = !memcmp(binary_value.GetBuffer(), + array_buffer_var->Map(), binary_value.GetSize()); array_buffer_var->Unmap(); return result; @@ -135,10 +132,8 @@ bool ConvertValueAndVerify(const base::Value& value) { class VarValueConversionsTest : public testing::Test { public: - VarValueConversionsTest() { - } - virtual ~VarValueConversionsTest() { - } + VarValueConversionsTest() {} + virtual ~VarValueConversionsTest() {} // testing::Test implementation. virtual void SetUp() { @@ -242,12 +237,12 @@ TEST_F(VarValueConversionsTest, CreateValueFromVar) { ScopedPPVar string_pp_var(ScopedPPVar::PassRef(), string_var->GetPPVar()); ASSERT_TRUE(dict_var_1->SetWithStringKey("null_key", PP_MakeNull())); - ASSERT_TRUE(dict_var_1->SetWithStringKey("string_key", - string_pp_var.get())); + ASSERT_TRUE( + dict_var_1->SetWithStringKey("string_key", string_pp_var.get())); ASSERT_TRUE(dict_var_1->SetWithStringKey("dict_key", dict_pp_var_2.get())); - ASSERT_TRUE(dict_var_2->SetWithStringKey("undefined_key", - PP_MakeUndefined())); + ASSERT_TRUE( + dict_var_2->SetWithStringKey("undefined_key", PP_MakeUndefined())); ASSERT_TRUE(dict_var_2->SetWithStringKey("double_key", PP_MakeDouble(1))); ASSERT_TRUE(dict_var_2->SetWithStringKey("array_key", array_pp_var.get())); |