Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: chrome/common/common_param_traits.h

Issue 3834003: On Windows, create a new TransportDIB::Handle struct which includes the file (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Rebase Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file is used to define IPC::ParamTraits<> specializations for a number 5 // This file is used to define IPC::ParamTraits<> specializations for a number
6 // of types so that they can be serialized over IPC. IPC::ParamTraits<> 6 // of types so that they can be serialized over IPC. IPC::ParamTraits<>
7 // specializations for basic types (like int and std::string) and types in the 7 // specializations for basic types (like int and std::string) and types in the
8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains 8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains
9 // specializations for types that are shared by more than one child process. 9 // specializations for types that are shared by more than one child process.
10 10
11 #ifndef CHROME_COMMON_COMMON_PARAM_TRAITS_H_ 11 #ifndef CHROME_COMMON_COMMON_PARAM_TRAITS_H_
12 #define CHROME_COMMON_COMMON_PARAM_TRAITS_H_ 12 #define CHROME_COMMON_COMMON_PARAM_TRAITS_H_
13 #pragma once 13 #pragma once
14 14
15 #if defined(OS_WIN)
16 #include <windows.h>
17 #endif
18
15 #include "app/surface/transport_dib.h" 19 #include "app/surface/transport_dib.h"
16 #include "base/file_util.h" 20 #include "base/file_util.h"
17 #include "base/ref_counted.h" 21 #include "base/ref_counted.h"
18 #include "chrome/common/content_settings.h" 22 #include "chrome/common/content_settings.h"
19 #include "chrome/common/page_zoom.h" 23 #include "chrome/common/page_zoom.h"
20 #include "gfx/native_widget_types.h" 24 #include "gfx/native_widget_types.h"
21 #include "ipc/ipc_message_utils.h" 25 #include "ipc/ipc_message_utils.h"
22 #include "net/url_request/url_request_status.h" 26 #include "net/url_request/url_request_status.h"
23 #include "printing/native_metafile.h" 27 #include "printing/native_metafile.h"
24 #include "webkit/glue/webcursor.h" 28 #include "webkit/glue/webcursor.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 template <> 233 template <>
230 struct ParamTraits<webkit_glue::WebApplicationInfo> { 234 struct ParamTraits<webkit_glue::WebApplicationInfo> {
231 typedef webkit_glue::WebApplicationInfo param_type; 235 typedef webkit_glue::WebApplicationInfo param_type;
232 static void Write(Message* m, const param_type& p); 236 static void Write(Message* m, const param_type& p);
233 static bool Read(const Message* m, void** iter, param_type* r); 237 static bool Read(const Message* m, void** iter, param_type* r);
234 static void Log(const param_type& p, std::string* l); 238 static void Log(const param_type& p, std::string* l);
235 }; 239 };
236 240
237 241
238 #if defined(OS_WIN) 242 #if defined(OS_WIN)
239 template<> 243 template <>
240 struct ParamTraits<TransportDIB::Id> { 244 struct ParamTraits<TransportDIB::Handle> {
241 typedef TransportDIB::Id param_type; 245 typedef TransportDIB::Handle param_type;
242 static void Write(Message* m, const param_type& p) { 246 static void Write(Message* m, const param_type& p) {
243 WriteParam(m, p.handle); 247 WriteParam(m, p.section());
244 WriteParam(m, p.sequence_num); 248 WriteParam(m, p.owner_id());
249 WriteParam(m, p.should_dup_on_map());
245 } 250 }
246 static bool Read(const Message* m, void** iter, param_type* r) { 251 static bool Read(const Message* m, void** iter, param_type* r) {
247 return (ReadParam(m, iter, &r->handle) && 252 HANDLE section;
248 ReadParam(m, iter, &r->sequence_num)); 253 base::ProcessId owner_id;
254 bool should_dup_on_map;
255 bool success = ReadParam(m, iter, &section) &&
256 ReadParam(m, iter, &owner_id) &&
257 ReadParam(m, iter, &should_dup_on_map);
258 if (success) {
259 *r = TransportDIB::Handle(section, owner_id, should_dup_on_map);
260 }
261 return success;
249 } 262 }
250 static void Log(const param_type& p, std::string* l) { 263 static void Log(const param_type& p, std::string* l) {
251 l->append("TransportDIB("); 264 l->append("TransportDIB::Handle(");
252 LogParam(p.handle, l); 265 LogParam(p.section(), l);
253 l->append(", "); 266 l->append(", ");
254 LogParam(p.sequence_num, l); 267 LogParam(p.owner_id(), l);
268 l->append(", ");
269 LogParam(p.should_dup_on_map(), l);
255 l->append(")"); 270 l->append(")");
256 } 271 }
257 }; 272 };
258 #endif 273 #endif
259 274
260 // Traits for URLRequestStatus 275 // Traits for URLRequestStatus
261 template <> 276 template <>
262 struct ParamTraits<URLRequestStatus> { 277 struct ParamTraits<URLRequestStatus> {
263 typedef URLRequestStatus param_type; 278 typedef URLRequestStatus param_type;
264 static void Write(Message* m, const param_type& p); 279 static void Write(Message* m, const param_type& p);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 struct ParamTraits<base::PlatformFileInfo> { 343 struct ParamTraits<base::PlatformFileInfo> {
329 typedef base::PlatformFileInfo param_type; 344 typedef base::PlatformFileInfo param_type;
330 static void Write(Message* m, const param_type& p); 345 static void Write(Message* m, const param_type& p);
331 static bool Read(const Message* m, void** iter, param_type* r); 346 static bool Read(const Message* m, void** iter, param_type* r);
332 static void Log(const param_type& p, std::string* l); 347 static void Log(const param_type& p, std::string* l);
333 }; 348 };
334 349
335 } // namespace IPC 350 } // namespace IPC
336 351
337 #endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_ 352 #endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698