Commit 01cca004 authored by jbates@chromium.org's avatar jbates@chromium.org

Add support for default values of IPC_STRUCT_MEMBER.


Review URL: http://codereview.chromium.org/10067023

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132435 0039d316-1c4b-4281-b951-d872f2087c98
parent 6b354c1d
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -516,7 +516,7 @@ class PickleCracker : public Pickle { ...@@ -516,7 +516,7 @@ class PickleCracker : public Pickle {
#define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent)\ #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent)\
IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_BEGIN(struct_name)
#define IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_TRAITS_BEGIN(struct_name) #define IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_TRAITS_BEGIN(struct_name)
#define IPC_STRUCT_MEMBER(type, name) IPC_STRUCT_TRAITS_MEMBER(name) #define IPC_STRUCT_MEMBER(type, name, ...) IPC_STRUCT_TRAITS_MEMBER(name)
#define IPC_STRUCT_END() IPC_STRUCT_TRAITS_END() #define IPC_STRUCT_END() IPC_STRUCT_TRAITS_END()
// Set up so next include will generate fuzz trait classes. // Set up so next include will generate fuzz trait classes.
......
...@@ -202,7 +202,9 @@ ...@@ -202,7 +202,9 @@
struct IPC_MESSAGE_EXPORT struct_name : parent { \ struct IPC_MESSAGE_EXPORT struct_name : parent { \
struct_name(); \ struct_name(); \
~struct_name(); ~struct_name();
#define IPC_STRUCT_MEMBER(type, name) type name; // Optional variadic parameters specify the default value for this struct
// member. They are passed through to the constructor for |type|.
#define IPC_STRUCT_MEMBER(type, name, ...) type name;
#define IPC_STRUCT_END() }; #define IPC_STRUCT_END() };
// Message macros collect specific numbers of arguments and funnel them into // Message macros collect specific numbers of arguments and funnel them into
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#define IPC_STRUCT_BEGIN(struct_name) #define IPC_STRUCT_BEGIN(struct_name)
#define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent)
#define IPC_STRUCT_MEMBER(type, name) #define IPC_STRUCT_MEMBER(type, name, ...)
#define IPC_STRUCT_END() #define IPC_STRUCT_END()
#define IPC_STRUCT_TRAITS_BEGIN(struct_name) #define IPC_STRUCT_TRAITS_BEGIN(struct_name)
#define IPC_STRUCT_TRAITS_MEMBER(name) #define IPC_STRUCT_TRAITS_MEMBER(name)
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \ #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \
IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_BEGIN(struct_name)
#define IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_TRAITS_BEGIN(struct_name) #define IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_TRAITS_BEGIN(struct_name)
#define IPC_STRUCT_MEMBER(type, name) IPC_STRUCT_TRAITS_MEMBER(name) #define IPC_STRUCT_MEMBER(type, name, ...) IPC_STRUCT_TRAITS_MEMBER(name)
#define IPC_STRUCT_END() IPC_STRUCT_TRAITS_END() #define IPC_STRUCT_END() IPC_STRUCT_TRAITS_END()
// Set up so next include will generate log methods. // Set up so next include will generate log methods.
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \ #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \
IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_BEGIN(struct_name)
#define IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_TRAITS_BEGIN(struct_name) #define IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_TRAITS_BEGIN(struct_name)
#define IPC_STRUCT_MEMBER(type, name) IPC_STRUCT_TRAITS_MEMBER(name) #define IPC_STRUCT_MEMBER(type, name, ...) IPC_STRUCT_TRAITS_MEMBER(name)
#define IPC_STRUCT_END() IPC_STRUCT_TRAITS_END() #define IPC_STRUCT_END() IPC_STRUCT_TRAITS_END()
// Set up so next include will generate read methods. // Set up so next include will generate read methods.
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \ #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \
IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_BEGIN(struct_name)
#define IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_TRAITS_BEGIN(struct_name) #define IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_TRAITS_BEGIN(struct_name)
#define IPC_STRUCT_MEMBER(type, name) IPC_STRUCT_TRAITS_MEMBER(name) #define IPC_STRUCT_MEMBER(type, name, ...) IPC_STRUCT_TRAITS_MEMBER(name)
#define IPC_STRUCT_END() IPC_STRUCT_TRAITS_END() #define IPC_STRUCT_END() IPC_STRUCT_TRAITS_END()
// Set up so next include will generate write methods. // Set up so next include will generate write methods.
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#define IPC_STRUCT_BEGIN(struct_name) struct_name::struct_name() : NoParams() #define IPC_STRUCT_BEGIN(struct_name) struct_name::struct_name() : NoParams()
#define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \ #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \
struct_name::struct_name() : parent() struct_name::struct_name() : parent()
#define IPC_STRUCT_MEMBER(type, name) , name() #define IPC_STRUCT_MEMBER(type, name, ...) , name(__VA_ARGS__)
#define IPC_STRUCT_END() {} #define IPC_STRUCT_END() {}
#endif // IPC_STRUCT_CONSTRUCTOR_MACROS_H_ #endif // IPC_STRUCT_CONSTRUCTOR_MACROS_H_
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment