diff options
author | jam <jam@chromium.org> | 2016-02-08 16:47:05 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-09 00:48:25 +0000 |
commit | 973236100b32d8faa23966bbcdd8860591aff970 (patch) | |
tree | e60cfbb1941464b675f4cb70c3a841e878875fa3 | |
parent | b73c4fc690d356021c11f7607e3f6751817bda74 (diff) | |
download | chromium_src-973236100b32d8faa23966bbcdd8860591aff970.zip chromium_src-973236100b32d8faa23966bbcdd8860591aff970.tar.gz chromium_src-973236100b32d8faa23966bbcdd8860591aff970.tar.bz2 |
Remove size_ts from IPC files.
This is because size_t's size depends on the architecture. We need IPCs to match as we're now going to support 32 and 64 bit processes communicating on Android.
This is split off from https://codereview.chromium.org/1619363002/.
BUG=581409
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation
Review URL: https://codereview.chromium.org/1673103002
Cr-Commit-Position: refs/heads/master@{#374241}
43 files changed, 158 insertions, 112 deletions
diff --git a/chrome/browser/password_manager/native_backend_kwallet_x.cc b/chrome/browser/password_manager/native_backend_kwallet_x.cc index c390696..b94523f 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x.cc @@ -123,11 +123,13 @@ bool DeserializeValueSize(const std::string& signon_realm, } count = count_32; } else { - if (!iter.ReadSizeT(&count)) { + uint64_t count_64 = 0; + if (!iter.ReadUInt64(&count_64)) { LOG(ERROR) << "Failed to deserialize KWallet entry " << "(realm: " << signon_realm << ")"; return false; } + count = static_cast<size_t>(count_64); } if (count > 0xFFFF) { @@ -236,7 +238,7 @@ bool DeserializeValueSize(const std::string& signon_realm, void SerializeValue(const std::vector<autofill::PasswordForm*>& forms, base::Pickle* pickle) { pickle->WriteInt(kPickleVersion); - pickle->WriteSizeT(forms.size()); + pickle->WriteUInt64(forms.size()); for (autofill::PasswordForm* form : forms) { pickle->WriteInt(form->scheme); pickle->WriteString(form->origin.spec()); diff --git a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc index babe5ca..9b166e4 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc @@ -1168,7 +1168,7 @@ void NativeBackendKWalletPickleTest::CreatePickle(bool size_32, if (size_32) pickle->WriteUInt32(1); // Size of form list. 32 bits. else - pickle->WriteSizeT(1); // Size of form list. 64 bits. + pickle->WriteUInt64(1); // Size of form list. 64 bits. pickle->WriteInt(form.scheme); pickle->WriteString(form.origin.spec()); pickle->WriteString(form.action.spec()); diff --git a/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc b/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc index 3c1c4c6..072a16f 100644 --- a/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc +++ b/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc @@ -51,10 +51,10 @@ ui::ClipboardType ConvertClipboardType(uint32_t type) { // clipboard interface for custom data. bool JumpToFormatInPickle(const base::string16& format, base::PickleIterator* iter) { - size_t size = 0; - if (!iter->ReadSizeT(&size)) + uint32_t size = 0; + if (!iter->ReadUInt32(&size)) return false; - for (size_t i = 0; i < size; ++i) { + for (uint32_t i = 0; i < size; ++i) { base::string16 stored_format; if (!iter->ReadString16(&stored_format)) return false; @@ -86,7 +86,7 @@ std::string ReadDataFromPickle(const base::string16& format, bool WriteDataToPickle(const std::map<base::string16, std::string>& data, base::Pickle* pickle) { - pickle->WriteSizeT(data.size()); + pickle->WriteUInt32(data.size()); for (std::map<base::string16, std::string>::const_iterator it = data.begin(); it != data.end(); ++it) { diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc index d108f42..efdfcc5 100644 --- a/chrome/common/render_messages.cc +++ b/chrome/common/render_messages.cc @@ -28,4 +28,40 @@ void ParamTraits<ContentSettingsPattern>::Log( l->append(">"); } +void ParamTraits<blink::WebCache::UsageStats>::Write( + base::Pickle* m, const blink::WebCache::UsageStats& u) { + m->WriteUInt32(base::checked_cast<int>(u.minDeadCapacity)); + m->WriteUInt32(base::checked_cast<int>(u.maxDeadCapacity)); + m->WriteUInt32(base::checked_cast<int>(u.capacity)); + m->WriteUInt32(base::checked_cast<int>(u.liveSize)); + m->WriteUInt32(base::checked_cast<int>(u.deadSize)); +} + +bool ParamTraits<blink::WebCache::UsageStats>::Read( + const base::Pickle* m, + base::PickleIterator* iter, + blink::WebCache::UsageStats* u) { + uint32_t min_capacity, max_capacity, capacity, live_size, dead_size; + if (!iter->ReadUInt32(&min_capacity) || + !iter->ReadUInt32(&max_capacity) || + !iter->ReadUInt32(&capacity) || + !iter->ReadUInt32(&live_size) || + !iter->ReadUInt32(&dead_size)) { + return false; + } + + u->minDeadCapacity = min_capacity; + u->maxDeadCapacity = max_capacity; + u->capacity = capacity; + u->liveSize = live_size; + u->deadSize = dead_size; + + return true; +} + +void ParamTraits<blink::WebCache::UsageStats>::Log( + const blink::WebCache::UsageStats& p, std::string* l) { + l->append("<blink::WebCache::UsageStats>"); +} + } // namespace IPC diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 5551665..61526f0 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -56,6 +56,18 @@ struct ParamTraits<ContentSettingsPattern> { static void Log(const param_type& p, std::string* l); }; +// Manual traits since this struct uses size_t and it's in Blink, so avoid +// changing Blink due to IPC differences. +template <> +struct ParamTraits<blink::WebCache::UsageStats> { + typedef blink::WebCache::UsageStats param_type; + static void Write(base::Pickle* m, const param_type& u); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* u); + static void Log(const param_type& p, std::string* l); +}; + } // namespace IPC #endif // CHROME_COMMON_RENDER_MESSAGES_H_ @@ -162,14 +174,6 @@ IPC_STRUCT_TRAITS_BEGIN(ThemeBackgroundInfo) IPC_STRUCT_TRAITS_MEMBER(logo_alternate) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(blink::WebCache::UsageStats) - IPC_STRUCT_TRAITS_MEMBER(minDeadCapacity) - IPC_STRUCT_TRAITS_MEMBER(maxDeadCapacity) - IPC_STRUCT_TRAITS_MEMBER(capacity) - IPC_STRUCT_TRAITS_MEMBER(liveSize) - IPC_STRUCT_TRAITS_MEMBER(deadSize) -IPC_STRUCT_TRAITS_END() - IPC_ENUM_TRAITS_MAX_VALUE(NTPLoggingEventType, NTP_EVENT_TYPE_LAST) diff --git a/chrome/common/spellcheck_marker.h b/chrome/common/spellcheck_marker.h index cb2de3f..4305c22 100644 --- a/chrome/common/spellcheck_marker.h +++ b/chrome/common/spellcheck_marker.h @@ -23,12 +23,13 @@ class SpellCheckMarker { }; // IPC requires a default constructor. - SpellCheckMarker() : hash(0xFFFFFFFF), offset(static_cast<size_t>(-1)) {} + SpellCheckMarker() : hash(0xFFFFFFFF), offset(UINT32_MAX) {} - SpellCheckMarker(uint32_t hash, size_t offset) : hash(hash), offset(offset) {} + SpellCheckMarker(uint32_t hash, uint32_t offset) + : hash(hash), offset(offset) {} uint32_t hash; - size_t offset; + uint32_t offset; }; #endif // CHROME_COMMON_SPELLCHECK_MARKER_H_ diff --git a/components/autofill/core/common/form_field_data.cc b/components/autofill/core/common/form_field_data.cc index 7b8d105..f3cebf2 100644 --- a/components/autofill/core/common/form_field_data.cc +++ b/components/autofill/core/common/form_field_data.cc @@ -57,7 +57,7 @@ bool DeserializeCommonSection1(base::PickleIterator* iter, iter->ReadString16(&field_data->value) && iter->ReadString(&field_data->form_control_type) && iter->ReadString(&field_data->autocomplete_attribute) && - iter->ReadSizeT(&field_data->max_length) && + iter->ReadUInt32(&field_data->max_length) && iter->ReadBool(&field_data->is_autofilled) && iter->ReadBool(&field_data->is_checked) && iter->ReadBool(&field_data->is_checkable) && @@ -155,7 +155,7 @@ void SerializeFormFieldData(const FormFieldData& field_data, pickle->WriteString16(field_data.value); pickle->WriteString(field_data.form_control_type); pickle->WriteString(field_data.autocomplete_attribute); - pickle->WriteSizeT(field_data.max_length); + pickle->WriteUInt32(field_data.max_length); pickle->WriteBool(field_data.is_autofilled); pickle->WriteBool(field_data.is_checked); pickle->WriteBool(field_data.is_checkable); diff --git a/components/autofill/core/common/form_field_data.h b/components/autofill/core/common/form_field_data.h index f711b77..0317239 100644 --- a/components/autofill/core/common/form_field_data.h +++ b/components/autofill/core/common/form_field_data.h @@ -45,7 +45,7 @@ struct FormFieldData { base::string16 value; std::string form_control_type; std::string autocomplete_attribute; - size_t max_length; + uint32_t max_length; bool is_autofilled; bool is_checked; bool is_checkable; diff --git a/components/autofill/core/common/form_field_data_unittest.cc b/components/autofill/core/common/form_field_data_unittest.cc index dc17277..3297f73 100644 --- a/components/autofill/core/common/form_field_data_unittest.cc +++ b/components/autofill/core/common/form_field_data_unittest.cc @@ -38,7 +38,7 @@ void WriteCommonSection1(const FormFieldData& data, base::Pickle* pickle) { pickle->WriteString16(data.value); pickle->WriteString(data.form_control_type); pickle->WriteString(data.autocomplete_attribute); - pickle->WriteSizeT(data.max_length); + pickle->WriteUInt32(data.max_length); pickle->WriteBool(data.is_autofilled); pickle->WriteBool(data.is_checked); pickle->WriteBool(data.is_checkable); diff --git a/components/bookmarks/browser/bookmark_node_data.cc b/components/bookmarks/browser/bookmark_node_data.cc index 5046ad8..83d160f 100644 --- a/components/bookmarks/browser/bookmark_node_data.cc +++ b/components/bookmarks/browser/bookmark_node_data.cc @@ -42,14 +42,14 @@ void BookmarkNodeData::Element::WriteToPickle(base::Pickle* pickle) const { pickle->WriteString(url.spec()); pickle->WriteString16(title); pickle->WriteInt64(id_); - pickle->WriteSizeT(meta_info_map.size()); + pickle->WriteUInt32(static_cast<uint32_t>(meta_info_map.size())); for (BookmarkNode::MetaInfoMap::const_iterator it = meta_info_map.begin(); it != meta_info_map.end(); ++it) { pickle->WriteString(it->first); pickle->WriteString(it->second); } if (!is_url) { - pickle->WriteSizeT(children.size()); + pickle->WriteUInt32(static_cast<uint32_t>(children.size())); for (std::vector<Element>::const_iterator i = children.begin(); i != children.end(); ++i) { i->WriteToPickle(pickle); @@ -69,8 +69,8 @@ bool BookmarkNodeData::Element::ReadFromPickle(base::PickleIterator* iterator) { date_added = base::Time(); date_folder_modified = base::Time(); meta_info_map.clear(); - size_t meta_field_count; - if (!iterator->ReadSizeT(&meta_field_count)) + uint32_t meta_field_count; + if (!iterator->ReadUInt32(&meta_field_count)) return false; for (size_t i = 0; i < meta_field_count; ++i) { std::string key; @@ -83,8 +83,8 @@ bool BookmarkNodeData::Element::ReadFromPickle(base::PickleIterator* iterator) { } children.clear(); if (!is_url) { - size_t children_count; - if (!iterator->ReadSizeT(&children_count)) + uint32_t children_count; + if (!iterator->ReadUInt32(&children_count)) return false; children.reserve(children_count); for (size_t i = 0; i < children_count; ++i) { @@ -234,7 +234,7 @@ bool BookmarkNodeData::ReadFromClipboard(ui::ClipboardType type) { void BookmarkNodeData::WriteToPickle(const base::FilePath& profile_path, base::Pickle* pickle) const { profile_path.WriteToPickle(pickle); - pickle->WriteSizeT(size()); + pickle->WriteUInt32(static_cast<uint32_t>(size())); for (size_t i = 0; i < size(); ++i) elements[i].WriteToPickle(pickle); @@ -242,9 +242,9 @@ void BookmarkNodeData::WriteToPickle(const base::FilePath& profile_path, bool BookmarkNodeData::ReadFromPickle(base::Pickle* pickle) { base::PickleIterator data_iterator(*pickle); - size_t element_count; + uint32_t element_count; if (profile_path_.ReadFromPickle(&data_iterator) && - data_iterator.ReadSizeT(&element_count)) { + data_iterator.ReadUInt32(&element_count)) { std::vector<Element> tmp_elements; tmp_elements.resize(element_count); for (size_t i = 0; i < element_count; ++i) { diff --git a/components/web_cache/browser/web_cache_manager.cc b/components/web_cache/browser/web_cache_manager.cc index 4583656..c325a2f 100644 --- a/components/web_cache/browser/web_cache_manager.cc +++ b/components/web_cache/browser/web_cache_manager.cc @@ -307,19 +307,18 @@ void WebCacheManager::EnactStrategy(const AllocationStrategy& strategy) { content::RenderProcessHost::FromID(allocation->first); if (host) { // This is the capacity this renderer has been allocated. - size_t capacity = allocation->second; + uint32_t capacity = allocation->second; // We don't reserve any space for dead objects in the cache. Instead, we // prefer to keep live objects around. There is probably some performance // tuning to be done here. - size_t min_dead_capacity = 0; + uint32_t min_dead_capacity = 0; // We allow the dead objects to consume up to half of the cache capacity. - size_t max_dead_capacity = capacity / 2; - if (base::SysInfo::IsLowEndDevice()) { - max_dead_capacity = std::min(static_cast<size_t>(512 * 1024), - max_dead_capacity); - } + uint32_t max_dead_capacity = capacity / 2; + if (base::SysInfo::IsLowEndDevice()) + max_dead_capacity = std::min(512 * 1024u, max_dead_capacity); + host->Send(new WebCacheMsg_SetCacheCapacities(min_dead_capacity, max_dead_capacity, capacity)); diff --git a/components/web_cache/common/web_cache_messages.h b/components/web_cache/common/web_cache_messages.h index 5ff9f25..58f9c70 100644 --- a/components/web_cache/common/web_cache_messages.h +++ b/components/web_cache/common/web_cache_messages.h @@ -17,9 +17,9 @@ // Tells the renderer to set its maximum cache size to the supplied value. IPC_MESSAGE_CONTROL3(WebCacheMsg_SetCacheCapacities, - size_t /* min_dead_capacity */, - size_t /* max_dead_capacity */, - size_t /* capacity */) + uint32_t /* min_dead_capacity */, + uint32_t /* max_dead_capacity */, + uint32_t /* capacity */) // Tells the renderer to clear the cache. IPC_MESSAGE_CONTROL1(WebCacheMsg_ClearCache, diff --git a/components/web_cache/renderer/web_cache_render_process_observer.cc b/components/web_cache/renderer/web_cache_render_process_observer.cc index a273817..a944ba1 100644 --- a/components/web_cache/renderer/web_cache_render_process_observer.cc +++ b/components/web_cache/renderer/web_cache_render_process_observer.cc @@ -60,9 +60,9 @@ void WebCacheRenderProcessObserver::OnRenderProcessShutdown() { } void WebCacheRenderProcessObserver::OnSetCacheCapacities( - size_t min_dead_capacity, - size_t max_dead_capacity, - size_t capacity) { + uint32_t min_dead_capacity, + uint32_t max_dead_capacity, + uint32_t capacity) { if (!webkit_initialized_) { pending_cache_min_dead_capacity_ = min_dead_capacity; pending_cache_max_dead_capacity_ = max_dead_capacity; diff --git a/components/web_cache/renderer/web_cache_render_process_observer.h b/components/web_cache/renderer/web_cache_render_process_observer.h index 6ae6916..b683fa7 100644 --- a/components/web_cache/renderer/web_cache_render_process_observer.h +++ b/components/web_cache/renderer/web_cache_render_process_observer.h @@ -6,6 +6,7 @@ #define COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_ #include <stddef.h> +#include <stdint.h> #include "base/compiler_specific.h" #include "base/macros.h" @@ -30,9 +31,9 @@ class WebCacheRenderProcessObserver : public content::RenderProcessObserver { void OnRenderProcessShutdown() override; // Message handlers. - void OnSetCacheCapacities(size_t min_dead_capacity, - size_t max_dead_capacity, - size_t capacity); + void OnSetCacheCapacities(uint32_t min_dead_capacity, + uint32_t max_dead_capacity, + uint32_t capacity); // If |on_navigation| is true, the clearing is delayed until the next // navigation event. void OnClearCache(bool on_navigation); diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc index bf8109d..e52a4b25 100644 --- a/content/browser/fileapi/fileapi_message_filter.cc +++ b/content/browser/fileapi/fileapi_message_filter.cc @@ -547,7 +547,7 @@ void FileAPIMessageFilter::OnAppendBlobDataItemToBlob( void FileAPIMessageFilter::OnAppendSharedMemoryToBlob( const std::string& uuid, base::SharedMemoryHandle handle, - size_t buffer_size) { + uint32_t buffer_size) { DCHECK(base::SharedMemory::IsHandleValid(handle)); if (!buffer_size) { bad_message::ReceivedBadMessage( @@ -634,7 +634,8 @@ void FileAPIMessageFilter::OnAppendBlobDataItemToStream( } void FileAPIMessageFilter::OnAppendSharedMemoryToStream( - const GURL& url, base::SharedMemoryHandle handle, size_t buffer_size) { + const GURL& url, base::SharedMemoryHandle handle, + uint32_t buffer_size) { DCHECK(base::SharedMemory::IsHandleValid(handle)); if (!buffer_size) { bad_message::ReceivedBadMessage( diff --git a/content/browser/fileapi/fileapi_message_filter.h b/content/browser/fileapi/fileapi_message_filter.h index 74d056f..25eb8f6 100644 --- a/content/browser/fileapi/fileapi_message_filter.h +++ b/content/browser/fileapi/fileapi_message_filter.h @@ -135,7 +135,7 @@ class CONTENT_EXPORT FileAPIMessageFilter : public BrowserMessageFilter { const storage::DataElement& item); void OnAppendSharedMemoryToBlob(const std::string& uuid, base::SharedMemoryHandle handle, - size_t buffer_size); + uint32_t buffer_size); void OnFinishBuildingBlob(const std::string& uuid, const std::string& content_type); void OnIncrementBlobRefCount(const std::string& uuid); @@ -155,7 +155,7 @@ class CONTENT_EXPORT FileAPIMessageFilter : public BrowserMessageFilter { void OnAppendBlobDataItemToStream(const GURL& url, const storage::DataElement& item); void OnAppendSharedMemoryToStream( - const GURL& url, base::SharedMemoryHandle handle, size_t buffer_size); + const GURL& url, base::SharedMemoryHandle handle, uint32_t buffer_size); void OnFlushStream(const GURL& url); void OnFinishBuildingStream(const GURL& url); void OnAbortBuildingStream(const GURL& url); diff --git a/content/browser/fileapi/fileapi_message_filter_unittest.cc b/content/browser/fileapi/fileapi_message_filter_unittest.cc index 1fe224e..b7d61e3 100644 --- a/content/browser/fileapi/fileapi_message_filter_unittest.cc +++ b/content/browser/fileapi/fileapi_message_filter_unittest.cc @@ -249,7 +249,7 @@ TEST_F(FileAPIMessageFilterTest, BuildStreamWithSharedMemory) { ASSERT_TRUE(shared_memory->CreateAndMapAnonymous(kFakeData.size())); memcpy(shared_memory->memory(), kFakeData.data(), kFakeData.size()); StreamHostMsg_SyncAppendSharedMemory append_message( - kUrl, shared_memory->handle(), kFakeData.size()); + kUrl, shared_memory->handle(), static_cast<uint32_t>(kFakeData.size())); EXPECT_TRUE(filter_->OnMessageReceived(append_message)); StreamHostMsg_FinishBuilding finish_message(kUrl); diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 4499835..9f8ead4 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc @@ -1396,8 +1396,8 @@ void RenderFrameHostImpl::OnRunBeforeUnloadConfirm( void RenderFrameHostImpl::OnTextSurroundingSelectionResponse( const base::string16& content, - size_t start_offset, - size_t end_offset) { + uint32_t start_offset, + uint32_t end_offset) { render_view_host_->OnTextSurroundingSelectionResponse( content, start_offset, end_offset); } diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h index d51b1a5..9767a4a 100644 --- a/content/browser/frame_host/render_frame_host_impl.h +++ b/content/browser/frame_host/render_frame_host_impl.h @@ -593,8 +593,8 @@ class CONTENT_EXPORT RenderFrameHostImpl bool is_reload, IPC::Message* reply_msg); void OnTextSurroundingSelectionResponse(const base::string16& content, - size_t start_offset, - size_t end_offset); + uint32_t start_offset, + uint32_t end_offset); void OnDidAccessInitialDocument(); void OnDidChangeOpener(int32_t opener_routing_id); void OnDidChangeName(const std::string& name); diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 197e58a..ae1ef2e 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -1301,10 +1301,10 @@ const NativeWebKeyboardEvent* } void RenderWidgetHostImpl::OnSelectionChanged(const base::string16& text, - size_t offset, + uint32_t offset, const gfx::Range& range) { if (view_) - view_->SelectionChanged(text, offset, range); + view_->SelectionChanged(text, static_cast<size_t>(offset), range); } void RenderWidgetHostImpl::OnSelectionBoundsChanged( diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index 820f0e2..f14edda 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -592,7 +592,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl : public RenderWidgetHost, gfx::NativeViewId dummy_activation_window); #endif void OnSelectionChanged(const base::string16& text, - size_t offset, + uint32_t offset, const gfx::Range& range); void OnSelectionBoundsChanged( const ViewHostMsg_SelectionBounds_Params& params); diff --git a/content/browser/renderer_host/text_input_client_mac_unittest.mm b/content/browser/renderer_host/text_input_client_mac_unittest.mm index aa265fca..51cb789 100644 --- a/content/browser/renderer_host/text_input_client_mac_unittest.mm +++ b/content/browser/renderer_host/text_input_client_mac_unittest.mm @@ -148,7 +148,6 @@ TEST_F(TextInputClientMacTest, TimeoutCharacterIndex) { TEST_F(TextInputClientMacTest, NotFoundCharacterIndex) { ScopedTestingThread thread(this); const NSUInteger kPreviousValue = 42; - const size_t kNotFoundValue = static_cast<size_t>(-1); // Set an arbitrary value to ensure the index is not |NSNotFound|. PostTask(FROM_HERE, @@ -159,7 +158,7 @@ TEST_F(TextInputClientMacTest, NotFoundCharacterIndex) { new TextInputClientMessageFilter(widget()->GetProcess()->GetID())); scoped_ptr<IPC::Message> message( new TextInputClientReplyMsg_GotCharacterIndexForPoint( - widget()->GetRoutingID(), kNotFoundValue)); + widget()->GetRoutingID(), UINT32_MAX)); // Set |WTF::notFound| to the index |kTaskDelayMs| after the previous // setting. PostTask(FROM_HERE, diff --git a/content/browser/renderer_host/text_input_client_message_filter.h b/content/browser/renderer_host/text_input_client_message_filter.h index 9400065..95780b0 100644 --- a/content/browser/renderer_host/text_input_client_message_filter.h +++ b/content/browser/renderer_host/text_input_client_message_filter.h @@ -38,7 +38,7 @@ class CONTENT_EXPORT TextInputClientMessageFilter void OnGotStringAtPoint( const mac::AttributedStringCoder::EncodedString& encoded_string, const gfx::Point& point); - void OnGotCharacterIndexForPoint(size_t index); + void OnGotCharacterIndexForPoint(uint32_t index); void OnGotFirstRectForRange(const gfx::Rect& rect); void OnGotStringFromRange( const mac::AttributedStringCoder::EncodedString& string, diff --git a/content/browser/renderer_host/text_input_client_message_filter.mm b/content/browser/renderer_host/text_input_client_message_filter.mm index 34e9467..56dba28 100644 --- a/content/browser/renderer_host/text_input_client_message_filter.mm +++ b/content/browser/renderer_host/text_input_client_message_filter.mm @@ -48,14 +48,17 @@ void TextInputClientMessageFilter::OnGotStringAtPoint( service->GetStringAtPointReply(string, NSPointFromCGPoint(point.ToCGPoint())); } -void TextInputClientMessageFilter::OnGotCharacterIndexForPoint(size_t index) { +void TextInputClientMessageFilter::OnGotCharacterIndexForPoint(uint32_t index) { TextInputClientMac* service = TextInputClientMac::GetInstance(); // |index| could be WTF::notFound (-1) and its value is different from // NSNotFound so we need to convert it. - if (index == static_cast<size_t>(-1)) { - index = NSNotFound; + size_t char_index; + if (index == UINT32_MAX) { + char_index = NSNotFound; + } else { + char_index = index; } - service->SetCharacterIndexAndSignal(index); + service->SetCharacterIndexAndSignal(char_index); } void TextInputClientMessageFilter::OnGotFirstRectForRange( diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index 30db92b..3cae1cc 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc @@ -238,7 +238,7 @@ const ui::Clipboard::FormatType& GetFileSystemFileFormatType() { void WriteFileSystemFilesToPickle( const std::vector<DropData::FileSystemFileInfo>& file_system_files, base::Pickle* pickle) { - pickle->WriteSizeT(file_system_files.size()); + pickle->WriteUInt32(file_system_files.size()); for (size_t i = 0; i < file_system_files.size(); ++i) { pickle->WriteString(file_system_files[i].url.spec()); pickle->WriteInt64(file_system_files[i].size); @@ -251,12 +251,12 @@ bool ReadFileSystemFilesFromPickle( std::vector<DropData::FileSystemFileInfo>* file_system_files) { base::PickleIterator iter(pickle); - size_t num_files = 0; - if (!iter.ReadSizeT(&num_files)) + uint32_t num_files = 0; + if (!iter.ReadUInt32(&num_files)) return false; file_system_files->resize(num_files); - for (size_t i = 0; i < num_files; ++i) { + for (uint32_t i = 0; i < num_files; ++i) { std::string url_string; int64_t size = 0; if (!iter.ReadString(&url_string) || !iter.ReadInt64(&size)) diff --git a/content/child/webblobregistry_impl.cc b/content/child/webblobregistry_impl.cc index ecdc0fc..48a5739 100644 --- a/content/child/webblobregistry_impl.cc +++ b/content/child/webblobregistry_impl.cc @@ -300,7 +300,7 @@ void WebBlobRegistryImpl::BuilderImpl::SendOversizedDataForBlob( consolidation_.ReadMemory(consolidated_item_index, offset, chunk_size, shared_memory->memory()); sender_->Send(new BlobHostMsg_SyncAppendSharedMemory( - uuid_, shared_memory->handle(), chunk_size)); + uuid_, shared_memory->handle(), static_cast<uint32_t>(chunk_size))); data_size -= chunk_size; offset += chunk_size; } diff --git a/content/common/android/sync_compositor_messages.h b/content/common/android/sync_compositor_messages.h index f0381e5..d3a3f99 100644 --- a/content/common/android/sync_compositor_messages.h +++ b/content/common/android/sync_compositor_messages.h @@ -25,7 +25,7 @@ struct SyncCompositorCommonBrowserParams { SyncCompositorCommonBrowserParams(); ~SyncCompositorCommonBrowserParams(); - size_t bytes_limit; + uint32_t bytes_limit; cc::CompositorFrameAck ack; gfx::ScrollOffset root_scroll_offset; bool update_root_scroll_offset; @@ -54,7 +54,7 @@ struct SyncCompositorDemandDrawHwParams { struct SyncCompositorSetSharedMemoryParams { SyncCompositorSetSharedMemoryParams(); - size_t buffer_size; + uint32_t buffer_size; base::SharedMemoryHandle shm_handle; }; diff --git a/content/common/fileapi/webblob_messages.h b/content/common/fileapi/webblob_messages.h index a836fd4..0dd3141 100644 --- a/content/common/fileapi/webblob_messages.h +++ b/content/common/fileapi/webblob_messages.h @@ -26,7 +26,7 @@ IPC_MESSAGE_CONTROL2(BlobHostMsg_AppendBlobDataItem, IPC_SYNC_MESSAGE_CONTROL3_0(BlobHostMsg_SyncAppendSharedMemory, std::string /*uuid*/, base::SharedMemoryHandle, - size_t /* buffer size */) + uint32_t /* buffer size */) IPC_MESSAGE_CONTROL2(BlobHostMsg_FinishBuilding, std::string /* uuid */, std::string /* content_type */) @@ -57,7 +57,7 @@ IPC_MESSAGE_CONTROL2(StreamHostMsg_AppendBlobDataItem, IPC_SYNC_MESSAGE_CONTROL3_0(StreamHostMsg_SyncAppendSharedMemory, GURL /* url */, base::SharedMemoryHandle, - size_t /* buffer size */) + uint32_t /* buffer size */) // Flushes contents buffered in the stream. IPC_MESSAGE_CONTROL1(StreamHostMsg_Flush, diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h index 77dd2f3..4c3c4ec 100644 --- a/content/common/frame_messages.h +++ b/content/common/frame_messages.h @@ -727,7 +727,7 @@ IPC_MESSAGE_ROUTED0(FrameMsg_DeleteProxy) // Request the text surrounding the selection with a |max_length|. The response // will be sent via FrameHostMsg_TextSurroundingSelectionResponse. IPC_MESSAGE_ROUTED1(FrameMsg_TextSurroundingSelectionRequest, - size_t /* max_length */) + uint32_t /* max_length */) // Tells the renderer to insert a link to the specified stylesheet. This is // needed to support navigation transitions. @@ -1280,8 +1280,8 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_DidChangeThemeColor, // |endOffset| are the offsets of the selection in the returned |content|. IPC_MESSAGE_ROUTED3(FrameHostMsg_TextSurroundingSelectionResponse, base::string16, /* content */ - size_t, /* startOffset */ - size_t /* endOffset */) + uint32_t, /* startOffset */ + uint32_t/* endOffset */) // Register a new handler for URL requests with the given scheme. IPC_MESSAGE_ROUTED4(FrameHostMsg_RegisterProtocolHandler, diff --git a/content/common/gpu/gpu_memory_uma_stats.h b/content/common/gpu/gpu_memory_uma_stats.h index 15d874f..16c8813 100644 --- a/content/common/gpu/gpu_memory_uma_stats.h +++ b/content/common/gpu/gpu_memory_uma_stats.h @@ -19,13 +19,13 @@ struct GPUMemoryUmaStats { } // The number of bytes currently allocated. - size_t bytes_allocated_current; + uint32_t bytes_allocated_current; // The maximum number of bytes ever allocated at once. - size_t bytes_allocated_max; + uint32_t bytes_allocated_max; // The number of context groups. - size_t context_group_count; + uint32_t context_group_count; }; } // namespace content diff --git a/content/common/text_input_client_messages.h b/content/common/text_input_client_messages.h index 70da1d8..f66196c 100644 --- a/content/common/text_input_client_messages.h +++ b/content/common/text_input_client_messages.h @@ -48,7 +48,7 @@ IPC_MESSAGE_ROUTED1(TextInputClientMsg_StringAtPoint, gfx::Point) // Reply message for TextInputClientMsg_CharacterIndexForPoint. IPC_MESSAGE_ROUTED1(TextInputClientReplyMsg_GotCharacterIndexForPoint, - size_t /* character index */) + uint32_t /* character index */) // Reply message for TextInputClientMsg_FirstRectForCharacterRange. IPC_MESSAGE_ROUTED1(TextInputClientReplyMsg_GotFirstRectForRange, diff --git a/content/common/view_messages.h b/content/common/view_messages.h index b1b8109..42a6e04 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -1163,7 +1163,7 @@ IPC_MESSAGE_ROUTED2(ViewHostMsg_SetTooltipText, // text in the document. IPC_MESSAGE_ROUTED3(ViewHostMsg_SelectionChanged, base::string16 /* text covers the selection range */, - size_t /* the offset of the text in the document */, + uint32_t /* the offset of the text in the document */, gfx::Range /* selection range in the document */) // Notification that the selection bounds have changed. diff --git a/content/public/common/gpu_memory_stats.h b/content/public/common/gpu_memory_stats.h index cb28b23..09bda3f 100644 --- a/content/public/common/gpu_memory_stats.h +++ b/content/public/common/gpu_memory_stats.h @@ -26,7 +26,7 @@ struct CONTENT_EXPORT GPUVideoMemoryUsageStats { ~ProcessStats(); // The bytes of GPU resources accessible by this process - size_t video_memory; + uint32_t video_memory; // Set to true if this process' GPU resource count is inflated because // it is counting other processes' resources (e.g, the GPU process has @@ -39,10 +39,10 @@ struct CONTENT_EXPORT GPUVideoMemoryUsageStats { ProcessMap process_map; // The total amount of GPU memory allocated at the time of the request. - size_t bytes_allocated; + uint32_t bytes_allocated; // The maximum amount of GPU memory ever allocated at once. - size_t bytes_allocated_historical_max; + uint32_t bytes_allocated_historical_max; }; } // namespace content diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h index 43182a6..ea2ba2b 100644 --- a/content/public/renderer/render_frame_observer.h +++ b/content/public/renderer/render_frame_observer.h @@ -96,7 +96,7 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, virtual void DetailedConsoleMessageAdded(const base::string16& message, const base::string16& source, const base::string16& stack_trace, - int32_t line_number, + uint32_t line_number, int32_t severity_level) {} // Called when an interesting (from document lifecycle perspective), diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index c662306..e53afac 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -2134,7 +2134,7 @@ void RenderFrameImpl::OnReloadLoFiImages() { GetWebFrame()->reloadLoFiImages(); } -void RenderFrameImpl::OnTextSurroundingSelectionRequest(size_t max_length) { +void RenderFrameImpl::OnTextSurroundingSelectionRequest(uint32_t max_length) { blink::WebSurroundingText surroundingText; surroundingText.initialize(frame_->selectionRange(), max_length); @@ -2347,7 +2347,7 @@ void RenderFrameImpl::SetSelectedText(const base::string16& selection_text, // Use the routing id of Render Widget Host. Send(new ViewHostMsg_SelectionChanged(GetRenderWidget()->routing_id(), selection_text, - offset, + static_cast<uint32_t>(offset), range)); } @@ -2825,7 +2825,7 @@ void RenderFrameImpl::didAddMessageToConsole( FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DetailedConsoleMessageAdded( message.text, source_name, stack_trace, source_line, - static_cast<int32_t>(log_severity))); + static_cast<uint32_t>(log_severity))); } Send(new FrameHostMsg_AddMessageToConsole( diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 243066b..b8b55a3 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -771,7 +771,7 @@ class CONTENT_EXPORT RenderFrameImpl void OnExtendSelectionAndDelete(int before, int after); void OnReload(bool ignore_cache); void OnReloadLoFiImages(); - void OnTextSurroundingSelectionRequest(size_t max_length); + void OnTextSurroundingSelectionRequest(uint32_t max_length); void OnSetAccessibilityMode(AccessibilityMode new_mode); void OnSnapshotAccessibilityTree(int callback_id); void OnUpdateOpener(int opener_routing_id); diff --git a/content/renderer/text_input_client_observer.cc b/content/renderer/text_input_client_observer.cc index eda58f2..b97be4a 100644 --- a/content/renderer/text_input_client_observer.cc +++ b/content/renderer/text_input_client_observer.cc @@ -65,7 +65,8 @@ void TextInputClientObserver::OnStringAtPoint(gfx::Point point) { void TextInputClientObserver::OnCharacterIndexForPoint(gfx::Point point) { blink::WebPoint web_point(point); - size_t index = webview()->focusedFrame()->characterIndexForPoint(web_point); + uint32_t index = static_cast<uint32_t>( + webview()->focusedFrame()->characterIndexForPoint(web_point)); Send(new TextInputClientReplyMsg_GotCharacterIndexForPoint(routing_id(), index)); } diff --git a/extensions/renderer/extensions_render_frame_observer.cc b/extensions/renderer/extensions_render_frame_observer.cc index dd94caf..3f66f46 100644 --- a/extensions/renderer/extensions_render_frame_observer.cc +++ b/extensions/renderer/extensions_render_frame_observer.cc @@ -85,7 +85,7 @@ void ExtensionsRenderFrameObserver::DetailedConsoleMessageAdded( const base::string16& message, const base::string16& source, const base::string16& stack_trace_string, - int32_t line_number, + uint32_t line_number, int32_t severity_level) { base::string16 trimmed_message = message; StackTrace stack_trace = GetStackTraceFromMessage( diff --git a/extensions/renderer/extensions_render_frame_observer.h b/extensions/renderer/extensions_render_frame_observer.h index 391a33f..55521b2b 100644 --- a/extensions/renderer/extensions_render_frame_observer.h +++ b/extensions/renderer/extensions_render_frame_observer.h @@ -26,7 +26,7 @@ class ExtensionsRenderFrameObserver void DetailedConsoleMessageAdded(const base::string16& message, const base::string16& source, const base::string16& stack_trace, - int32_t line_number, + uint32_t line_number, int32_t severity_level) override; DISALLOW_COPY_AND_ASSIGN(ExtensionsRenderFrameObserver); diff --git a/media/cast/logging/logging_defines.h b/media/cast/logging/logging_defines.h index 455f85d..7d17507 100644 --- a/media/cast/logging/logging_defines.h +++ b/media/cast/logging/logging_defines.h @@ -64,7 +64,7 @@ struct FrameEvent { int height; // Size of encoded frame in bytes. Only set for FRAME_ENCODED event. - size_t size; + uint32_t size; // Time of event logged. base::TimeTicks timestamp; @@ -100,7 +100,7 @@ struct PacketEvent { uint32_t frame_id; uint16_t max_packet_id; uint16_t packet_id; - size_t size; + uint32_t size; // Time of event logged. base::TimeTicks timestamp; diff --git a/ui/app_list/search_result.h b/ui/app_list/search_result.h index a086547..130e30c 100644 --- a/ui/app_list/search_result.h +++ b/ui/app_list/search_result.h @@ -57,8 +57,7 @@ class APP_LIST_EXPORT SearchResult { Tag(int styles, size_t start, size_t end) : styles(styles), - range(start, end) { - } + range(static_cast<uint32_t>(start), static_cast<uint32_t>(end)) {} int styles; gfx::Range range; diff --git a/ui/base/clipboard/custom_data_helper.cc b/ui/base/clipboard/custom_data_helper.cc index a50a0a0..e67829a3 100644 --- a/ui/base/clipboard/custom_data_helper.cc +++ b/ui/base/clipboard/custom_data_helper.cc @@ -43,8 +43,8 @@ void ReadCustomDataTypes(const void* data, SkippablePickle pickle(data, data_length); base::PickleIterator iter(pickle); - size_t size = 0; - if (!iter.ReadSizeT(&size)) + uint32_t size = 0; + if (!iter.ReadUInt32(&size)) return; // Keep track of the original elements in the types vector. On failure, we @@ -52,7 +52,7 @@ void ReadCustomDataTypes(const void* data, // custom data pickles. size_t original_size = types->size(); - for (size_t i = 0; i < size; ++i) { + for (uint32_t i = 0; i < size; ++i) { types->push_back(base::string16()); if (!iter.ReadString16(&types->back()) || !pickle.SkipString16(&iter)) { types->resize(original_size); @@ -68,11 +68,11 @@ void ReadCustomDataForType(const void* data, SkippablePickle pickle(data, data_length); base::PickleIterator iter(pickle); - size_t size = 0; - if (!iter.ReadSizeT(&size)) + uint32_t size = 0; + if (!iter.ReadUInt32(&size)) return; - for (size_t i = 0; i < size; ++i) { + for (uint32_t i = 0; i < size; ++i) { base::string16 deserialized_type; if (!iter.ReadString16(&deserialized_type)) return; @@ -91,11 +91,11 @@ void ReadCustomDataIntoMap(const void* data, base::Pickle pickle(reinterpret_cast<const char*>(data), data_length); base::PickleIterator iter(pickle); - size_t size = 0; - if (!iter.ReadSizeT(&size)) + uint32_t size = 0; + if (!iter.ReadUInt32(&size)) return; - for (size_t i = 0; i < size; ++i) { + for (uint32_t i = 0; i < size; ++i) { base::string16 type; if (!iter.ReadString16(&type)) { // Data is corrupt, return an empty map. @@ -115,7 +115,7 @@ void ReadCustomDataIntoMap(const void* data, void WriteCustomDataToPickle( const std::map<base::string16, base::string16>& data, base::Pickle* pickle) { - pickle->WriteSizeT(data.size()); + pickle->WriteUInt32(data.size()); for (std::map<base::string16, base::string16>::const_iterator it = data.begin(); it != data.end(); diff --git a/ui/base/clipboard/custom_data_helper_unittest.cc b/ui/base/clipboard/custom_data_helper_unittest.cc index 1ed53c6..4d51547 100644 --- a/ui/base/clipboard/custom_data_helper_unittest.cc +++ b/ui/base/clipboard/custom_data_helper_unittest.cc @@ -120,7 +120,7 @@ TEST(CustomDataHelperTest, BadReadTypes) { expected.push_back(ASCIIToUTF16("f")); base::Pickle malformed; - malformed.WriteSizeT(1000); + malformed.WriteUInt32(1000); malformed.WriteString16(ASCIIToUTF16("hello")); malformed.WriteString16(ASCIIToUTF16("world")); std::vector<base::string16> actual(expected); @@ -128,7 +128,7 @@ TEST(CustomDataHelperTest, BadReadTypes) { EXPECT_EQ(expected, actual); base::Pickle malformed2; - malformed2.WriteSizeT(1); + malformed2.WriteUInt32(1); malformed2.WriteString16(ASCIIToUTF16("hello")); std::vector<base::string16> actual2(expected); ReadCustomDataTypes(malformed2.data(), malformed2.size(), &actual2); @@ -140,7 +140,7 @@ TEST(CustomDataHelperTest, BadPickle) { std::map<base::string16, base::string16> result_map; base::Pickle malformed; - malformed.WriteSizeT(1000); + malformed.WriteUInt32(1000); malformed.WriteString16(ASCIIToUTF16("hello")); malformed.WriteString16(ASCIIToUTF16("world")); @@ -153,7 +153,7 @@ TEST(CustomDataHelperTest, BadPickle) { EXPECT_EQ(0u, result_map.size()); base::Pickle malformed2; - malformed2.WriteSizeT(1); + malformed2.WriteUInt32(1); malformed2.WriteString16(ASCIIToUTF16("hello")); ReadCustomDataForType(malformed2.data(), |