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

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

Issue 20027: Capability: passing fds over IPC (Closed)
Patch Set: ... Created 11 years, 10 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
« no previous file with comments | « chrome/common/ipc_message.cc ('k') | chrome/common/ipc_tests.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_COMMON_IPC_MESSAGE_UTILS_H_ 5 #ifndef CHROME_COMMON_IPC_MESSAGE_UTILS_H_
6 #define CHROME_COMMON_IPC_MESSAGE_UTILS_H_ 6 #define CHROME_COMMON_IPC_MESSAGE_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 #include <map> 10 #include <map>
11 11
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/tuple.h" 14 #include "base/tuple.h"
15 #if defined(OS_POSIX)
16 #include "chrome/common/file_descriptor_posix.h"
17 #endif
15 #include "chrome/common/ipc_sync_message.h" 18 #include "chrome/common/ipc_sync_message.h"
16 #include "chrome/common/thumbnail_score.h" 19 #include "chrome/common/thumbnail_score.h"
17 #include "webkit/glue/cache_manager.h" 20 #include "webkit/glue/cache_manager.h"
18 #include "webkit/glue/console_message_level.h" 21 #include "webkit/glue/console_message_level.h"
19 #include "webkit/glue/find_in_page_request.h" 22 #include "webkit/glue/find_in_page_request.h"
20 #include "webkit/glue/webcursor.h" 23 #include "webkit/glue/webcursor.h"
21 #include "webkit/glue/window_open_disposition.h" 24 #include "webkit/glue/window_open_disposition.h"
22 25
23 // Forward declarations. 26 // Forward declarations.
24 class GURL; 27 class GURL;
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 }; 658 };
656 659
657 template <> 660 template <>
658 struct ParamTraits<gfx::Size> { 661 struct ParamTraits<gfx::Size> {
659 typedef gfx::Size param_type; 662 typedef gfx::Size param_type;
660 static void Write(Message* m, const param_type& p); 663 static void Write(Message* m, const param_type& p);
661 static bool Read(const Message* m, void** iter, param_type* r); 664 static bool Read(const Message* m, void** iter, param_type* r);
662 static void Log(const param_type& p, std::wstring* l); 665 static void Log(const param_type& p, std::wstring* l);
663 }; 666 };
664 667
668 #if defined(OS_POSIX)
669
670 template<>
671 struct ParamTraits<FileDescriptor> {
672 typedef FileDescriptor param_type;
673 static void Write(Message* m, const param_type& p) {
674 if (p.auto_close) {
675 m->descriptor_set()->AddAndAutoClose(p.fd);
676 } else {
677 m->descriptor_set()->Add(p.fd);
678 }
679 }
680 static bool Read(const Message* m, void** iter, param_type* r) {
681 r->auto_close = false;
682 r->fd = m->descriptor_set()->NextDescriptor();
683
684 return r->fd >= 0;
685 }
686 static void Log(const param_type& p, std::wstring* l) {
687 if (p.auto_close) {
688 l->append(StringPrintf(L"FD(%d auto-close)", p.fd));
689 } else {
690 l->append(StringPrintf(L"FD(%d)", p.fd));
691 }
692 }
693 };
694
695 #endif // defined(OS_POSIX)
696
665 template<> 697 template<>
666 struct ParamTraits<ThumbnailScore> { 698 struct ParamTraits<ThumbnailScore> {
667 typedef ThumbnailScore param_type; 699 typedef ThumbnailScore param_type;
668 static void Write(Message* m, const param_type& p) { 700 static void Write(Message* m, const param_type& p) {
669 IPC::ParamTraits<double>::Write(m, p.boring_score); 701 IPC::ParamTraits<double>::Write(m, p.boring_score);
670 IPC::ParamTraits<bool>::Write(m, p.good_clipping); 702 IPC::ParamTraits<bool>::Write(m, p.good_clipping);
671 IPC::ParamTraits<bool>::Write(m, p.at_top); 703 IPC::ParamTraits<bool>::Write(m, p.at_top);
672 IPC::ParamTraits<base::Time>::Write(m, p.time_at_snapshot); 704 IPC::ParamTraits<base::Time>::Write(m, p.time_at_snapshot);
673 } 705 }
674 static bool Read(const Message* m, void** iter, param_type* r) { 706 static bool Read(const Message* m, void** iter, param_type* r) {
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 l->append(L"<FindInPageRequest>"); 1371 l->append(L"<FindInPageRequest>");
1340 } 1372 }
1341 }; 1373 };
1342 1374
1343 //----------------------------------------------------------------------------- 1375 //-----------------------------------------------------------------------------
1344 1376
1345 } // namespace IPC 1377 } // namespace IPC
1346 1378
1347 #endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_ 1379 #endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_
1348 1380
OLDNEW
« no previous file with comments | « chrome/common/ipc_message.cc ('k') | chrome/common/ipc_tests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698