summaryrefslogtreecommitdiffstats
path: root/extensions/common
diff options
context:
space:
mode:
authorjam <jam@chromium.org>2016-02-08 18:13:03 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-09 02:13:58 +0000
commitb82272abe4f64121f0bdd95f18f84c7455420cf6 (patch)
treec919adf0f1cb543c59f0aedb175f005fbd8acfdf /extensions/common
parentc11d345c76dbf3ad45fdb45d7818f3709f551bf0 (diff)
downloadchromium_src-b82272abe4f64121f0bdd95f18f84c7455420cf6.zip
chromium_src-b82272abe4f64121f0bdd95f18f84c7455420cf6.tar.gz
chromium_src-b82272abe4f64121f0bdd95f18f84c7455420cf6.tar.bz2
Switch extension struct members that are sent over IPC to use uint32_t instead of size_t.
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 Review URL: https://codereview.chromium.org/1676093003 Cr-Commit-Position: refs/heads/master@{#374268}
Diffstat (limited to 'extensions/common')
-rw-r--r--extensions/common/extension_messages.cc12
-rw-r--r--extensions/common/stack_frame.cc7
-rw-r--r--extensions/common/stack_frame.h8
-rw-r--r--extensions/common/user_script.cc24
4 files changed, 25 insertions, 26 deletions
diff --git a/extensions/common/extension_messages.cc b/extensions/common/extension_messages.cc
index 5cccc11..d6ab4f2 100644
--- a/extensions/common/extension_messages.cc
+++ b/extensions/common/extension_messages.cc
@@ -187,7 +187,7 @@ void ParamTraits<APIPermissionSet>::Write(base::Pickle* m,
const param_type& p) {
APIPermissionSet::const_iterator it = p.begin();
const APIPermissionSet::const_iterator end = p.end();
- WriteParam(m, p.size());
+ WriteParam(m, static_cast<uint32_t>(p.size()));
for (; it != end; ++it) {
WriteParam(m, it->id());
it->Write(m);
@@ -197,10 +197,10 @@ void ParamTraits<APIPermissionSet>::Write(base::Pickle* m,
bool ParamTraits<APIPermissionSet>::Read(const base::Pickle* m,
base::PickleIterator* iter,
param_type* r) {
- size_t size;
+ uint32_t size;
if (!ReadParam(m, iter, &size))
return false;
- for (size_t i = 0; i < size; ++i) {
+ for (uint32_t i = 0; i < size; ++i) {
APIPermission::ID id;
if (!ReadParam(m, iter, &id))
return false;
@@ -225,7 +225,7 @@ void ParamTraits<ManifestPermissionSet>::Write(base::Pickle* m,
const param_type& p) {
ManifestPermissionSet::const_iterator it = p.begin();
const ManifestPermissionSet::const_iterator end = p.end();
- WriteParam(m, p.size());
+ WriteParam(m, static_cast<uint32_t>(p.size()));
for (; it != end; ++it) {
WriteParam(m, it->name());
it->Write(m);
@@ -235,10 +235,10 @@ void ParamTraits<ManifestPermissionSet>::Write(base::Pickle* m,
bool ParamTraits<ManifestPermissionSet>::Read(const base::Pickle* m,
base::PickleIterator* iter,
param_type* r) {
- size_t size;
+ uint32_t size;
if (!ReadParam(m, iter, &size))
return false;
- for (size_t i = 0; i < size; ++i) {
+ for (uint32_t i = 0; i < size; ++i) {
std::string name;
if (!ReadParam(m, iter, &name))
return false;
diff --git a/extensions/common/stack_frame.cc b/extensions/common/stack_frame.cc
index 0286c5b..046a265 100644
--- a/extensions/common/stack_frame.cc
+++ b/extensions/common/stack_frame.cc
@@ -25,16 +25,15 @@ StackFrame::StackFrame(const StackFrame& frame)
function(frame.function) {
}
-StackFrame::StackFrame(size_t line_number,
- size_t column_number,
+StackFrame::StackFrame(uint32_t line_number,
+ uint32_t column_number,
const base::string16& source,
const base::string16& function)
: line_number(line_number),
column_number(column_number),
source(source),
function(function.empty() ? base::UTF8ToUTF16(kAnonymousFunction)
- : function) {
-}
+ : function) {}
StackFrame::~StackFrame() {
}
diff --git a/extensions/common/stack_frame.h b/extensions/common/stack_frame.h
index 671f564..b174ffc 100644
--- a/extensions/common/stack_frame.h
+++ b/extensions/common/stack_frame.h
@@ -17,8 +17,8 @@ namespace extensions {
struct StackFrame {
StackFrame();
StackFrame(const StackFrame& frame);
- StackFrame(size_t line_number,
- size_t column_number,
+ StackFrame(uint32_t line_number,
+ uint32_t column_number,
const base::string16& source,
const base::string16& function);
~StackFrame();
@@ -29,8 +29,8 @@ struct StackFrame {
bool operator==(const StackFrame& rhs) const;
- size_t line_number;
- size_t column_number;
+ uint32_t line_number;
+ uint32_t column_number;
base::string16 source;
base::string16 function; // optional
};
diff --git a/extensions/common/user_script.cc b/extensions/common/user_script.cc
index 08adfbc..0bb3c8d 100644
--- a/extensions/common/user_script.cc
+++ b/extensions/common/user_script.cc
@@ -163,7 +163,7 @@ void UserScript::Pickle(base::Pickle* pickle) const {
void UserScript::PickleGlobs(base::Pickle* pickle,
const std::vector<std::string>& globs) const {
- pickle->WriteSizeT(globs.size());
+ pickle->WriteUInt32(globs.size());
for (std::vector<std::string>::const_iterator glob = globs.begin();
glob != globs.end(); ++glob) {
pickle->WriteString(*glob);
@@ -178,7 +178,7 @@ void UserScript::PickleHostID(base::Pickle* pickle,
void UserScript::PickleURLPatternSet(base::Pickle* pickle,
const URLPatternSet& pattern_list) const {
- pickle->WriteSizeT(pattern_list.patterns().size());
+ pickle->WriteUInt32(pattern_list.patterns().size());
for (URLPatternSet::const_iterator pattern = pattern_list.begin();
pattern != pattern_list.end(); ++pattern) {
pickle->WriteInt(pattern->valid_schemes());
@@ -188,7 +188,7 @@ void UserScript::PickleURLPatternSet(base::Pickle* pickle,
void UserScript::PickleScripts(base::Pickle* pickle,
const FileList& scripts) const {
- pickle->WriteSizeT(scripts.size());
+ pickle->WriteUInt32(scripts.size());
for (FileList::const_iterator file = scripts.begin();
file != scripts.end(); ++file) {
file->Pickle(pickle);
@@ -227,10 +227,10 @@ void UserScript::Unpickle(const base::Pickle& pickle,
void UserScript::UnpickleGlobs(const base::Pickle& pickle,
base::PickleIterator* iter,
std::vector<std::string>* globs) {
- size_t num_globs = 0;
- CHECK(iter->ReadSizeT(&num_globs));
+ uint32_t num_globs = 0;
+ CHECK(iter->ReadUInt32(&num_globs));
globs->clear();
- for (size_t i = 0; i < num_globs; ++i) {
+ for (uint32_t i = 0; i < num_globs; ++i) {
std::string glob;
CHECK(iter->ReadString(&glob));
globs->push_back(glob);
@@ -250,11 +250,11 @@ void UserScript::UnpickleHostID(const base::Pickle& pickle,
void UserScript::UnpickleURLPatternSet(const base::Pickle& pickle,
base::PickleIterator* iter,
URLPatternSet* pattern_list) {
- size_t num_patterns = 0;
- CHECK(iter->ReadSizeT(&num_patterns));
+ uint32_t num_patterns = 0;
+ CHECK(iter->ReadUInt32(&num_patterns));
pattern_list->ClearPatterns();
- for (size_t i = 0; i < num_patterns; ++i) {
+ for (uint32_t i = 0; i < num_patterns; ++i) {
int valid_schemes;
CHECK(iter->ReadInt(&valid_schemes));
@@ -274,10 +274,10 @@ void UserScript::UnpickleURLPatternSet(const base::Pickle& pickle,
void UserScript::UnpickleScripts(const base::Pickle& pickle,
base::PickleIterator* iter,
FileList* scripts) {
- size_t num_files = 0;
- CHECK(iter->ReadSizeT(&num_files));
+ uint32_t num_files = 0;
+ CHECK(iter->ReadUInt32(&num_files));
scripts->clear();
- for (size_t i = 0; i < num_files; ++i) {
+ for (uint32_t i = 0; i < num_files; ++i) {
File file;
file.Unpickle(pickle, iter);
scripts->push_back(file);