| OLD | NEW | 
|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.  Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.  Use of this | 
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the | 
| 3 // LICENSE file. | 3 // LICENSE file. | 
| 4 // | 4 // | 
| 5 // This file contains ParamTraits templates to support serialization of WebKit | 5 // This file contains ParamTraits templates to support serialization of WebKit | 
| 6 // data types over IPC. | 6 // data types over IPC. | 
| 7 // | 7 // | 
| 8 // NOTE: IT IS IMPORTANT THAT ONLY POD (plain old data) TYPES ARE SERIALIZED. | 8 // NOTE: IT IS IMPORTANT THAT ONLY POD (plain old data) TYPES ARE SERIALIZED. | 
| 9 // | 9 // | 
| 10 // There are several reasons for this restrictions: | 10 // There are several reasons for this restrictions: | 
| 11 // | 11 // | 
| 12 //   o  We don't want inclusion of this file to imply linking to WebKit code. | 12 //   o  We don't want inclusion of this file to imply linking to WebKit code. | 
| 13 // | 13 // | 
| 14 //   o  Many WebKit structures are not thread-safe.  WebString, for example, | 14 //   o  Many WebKit structures are not thread-safe.  WebString, for example, | 
| 15 //      contains a reference counted buffer, which does not use thread-safe | 15 //      contains a reference counted buffer, which does not use thread-safe | 
| 16 //      reference counting.  If we allowed serializing WebString, then we may ru
     n | 16 //      reference counting.  If we allowed serializing WebString, then we may ru
     n | 
| 17 //      the risk of introducing subtle thread-safety bugs if people passed a | 17 //      the risk of introducing subtle thread-safety bugs if people passed a | 
| 18 //      WebString across threads via PostTask(NewRunnableMethod(...)). | 18 //      WebString across threads via PostTask(NewRunnableMethod(...)). | 
| 19 // | 19 // | 
| 20 //   o  The WebKit API has redundant types for strings, and we should avoid usin
     g | 20 //   o  The WebKit API has redundant types for strings, and we should avoid usin
     g | 
| 21 //      those beyond code that interfaces with the WebKit API. | 21 //      those beyond code that interfaces with the WebKit API. | 
| 22 | 22 | 
| 23 #ifndef CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ | 23 #ifndef CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ | 
| 24 #define CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ | 24 #define CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ | 
| 25 | 25 | 
| 26 #include "ipc/ipc_message_utils.h" | 26 #include "ipc/ipc_message_utils.h" | 
| 27 #include "webkit/api/public/WebCache.h" | 27 #include "third_party/WebKit/WebKit/chromium/public/WebCache.h" | 
| 28 #include "webkit/api/public/WebCompositionCommand.h" | 28 #include "third_party/WebKit/WebKit/chromium/public/WebCompositionCommand.h" | 
| 29 #include "webkit/api/public/WebConsoleMessage.h" | 29 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" | 
| 30 #include "webkit/api/public/WebContextMenuData.h" | 30 #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h" | 
| 31 #include "webkit/api/public/WebDragOperation.h" | 31 #include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" | 
| 32 #include "webkit/api/public/WebFindOptions.h" | 32 #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" | 
| 33 #include "webkit/api/public/WebInputEvent.h" | 33 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" | 
| 34 #include "webkit/api/public/WebMediaPlayerAction.h" | 34 #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h" | 
| 35 #include "webkit/api/public/WebScreenInfo.h" | 35 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" | 
| 36 #include "webkit/api/public/WebTextDirection.h" | 36 #include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h" | 
| 37 | 37 | 
| 38 namespace IPC { | 38 namespace IPC { | 
| 39 | 39 | 
| 40 template <> | 40 template <> | 
| 41 struct ParamTraits<WebKit::WebRect> { | 41 struct ParamTraits<WebKit::WebRect> { | 
| 42   typedef WebKit::WebRect param_type; | 42   typedef WebKit::WebRect param_type; | 
| 43   static void Write(Message* m, const param_type& p) { | 43   static void Write(Message* m, const param_type& p) { | 
| 44     WriteParam(m, p.x); | 44     WriteParam(m, p.x); | 
| 45     WriteParam(m, p.y); | 45     WriteParam(m, p.y); | 
| 46     WriteParam(m, p.width); | 46     WriteParam(m, p.width); | 
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 368     int temp; | 368     int temp; | 
| 369     bool res = m->ReadInt(iter, &temp); | 369     bool res = m->ReadInt(iter, &temp); | 
| 370     *r = static_cast<param_type>(temp); | 370     *r = static_cast<param_type>(temp); | 
| 371     return res; | 371     return res; | 
| 372   } | 372   } | 
| 373 }; | 373 }; | 
| 374 | 374 | 
| 375 }  // namespace IPC | 375 }  // namespace IPC | 
| 376 | 376 | 
| 377 #endif  // CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ | 377 #endif  // CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ | 
| OLD | NEW | 
|---|