| OLD | NEW |
| 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) | 15 #if defined(OS_POSIX) |
| 16 #include "chrome/common/file_descriptor_posix.h" | 16 #include "chrome/common/descriptor_set_posix.h" |
| 17 #endif | 17 #endif |
| 18 #include "chrome/common/ipc_sync_message.h" | 18 #include "chrome/common/ipc_sync_message.h" |
| 19 #include "chrome/common/thumbnail_score.h" | 19 #include "chrome/common/thumbnail_score.h" |
| 20 #include "webkit/glue/cache_manager.h" | 20 #include "webkit/glue/cache_manager.h" |
| 21 #include "webkit/glue/console_message_level.h" | 21 #include "webkit/glue/console_message_level.h" |
| 22 #include "webkit/glue/find_in_page_request.h" | 22 #include "webkit/glue/find_in_page_request.h" |
| 23 #include "webkit/glue/webcursor.h" | 23 #include "webkit/glue/webcursor.h" |
| 24 #include "webkit/glue/window_open_disposition.h" | 24 #include "webkit/glue/window_open_disposition.h" |
| 25 | 25 |
| 26 // Forward declarations. | 26 // Forward declarations. |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 struct ParamTraits<gfx::Size> { | 661 struct ParamTraits<gfx::Size> { |
| 662 typedef gfx::Size param_type; | 662 typedef gfx::Size param_type; |
| 663 static void Write(Message* m, const param_type& p); | 663 static void Write(Message* m, const param_type& p); |
| 664 static bool Read(const Message* m, void** iter, param_type* r); | 664 static bool Read(const Message* m, void** iter, param_type* r); |
| 665 static void Log(const param_type& p, std::wstring* l); | 665 static void Log(const param_type& p, std::wstring* l); |
| 666 }; | 666 }; |
| 667 | 667 |
| 668 #if defined(OS_POSIX) | 668 #if defined(OS_POSIX) |
| 669 | 669 |
| 670 template<> | 670 template<> |
| 671 struct ParamTraits<FileDescriptor> { | 671 struct ParamTraits<base::FileDescriptor> { |
| 672 typedef FileDescriptor param_type; | 672 typedef base::FileDescriptor param_type; |
| 673 static void Write(Message* m, const param_type& p) { | 673 static void Write(Message* m, const param_type& p) { |
| 674 if (p.auto_close) { | 674 if (p.auto_close) { |
| 675 m->descriptor_set()->AddAndAutoClose(p.fd); | 675 if (!m->descriptor_set()->AddAndAutoClose(p.fd)) |
| 676 NOTREACHED(); |
| 676 } else { | 677 } else { |
| 677 m->descriptor_set()->Add(p.fd); | 678 if (!m->descriptor_set()->Add(p.fd)) |
| 679 NOTREACHED(); |
| 678 } | 680 } |
| 679 } | 681 } |
| 680 static bool Read(const Message* m, void** iter, param_type* r) { | 682 static bool Read(const Message* m, void** iter, param_type* r) { |
| 681 r->auto_close = false; | 683 r->auto_close = false; |
| 682 r->fd = m->descriptor_set()->NextDescriptor(); | 684 r->fd = m->descriptor_set()->NextDescriptor(); |
| 683 | 685 |
| 684 // We always return true here because some of the IPC message logging | 686 // We always return true here because some of the IPC message logging |
| 685 // functions want to parse the message multiple times. On the second and | 687 // functions want to parse the message multiple times. On the second and |
| 686 // later attempts, the descriptor_set will be empty and so will return -1, | 688 // later attempts, the descriptor_set will be empty and so will return -1, |
| 687 // however, failing to parse at log time is a fatal error. | 689 // however, failing to parse at log time is a fatal error. |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1375 l->append(L"<FindInPageRequest>"); | 1377 l->append(L"<FindInPageRequest>"); |
| 1376 } | 1378 } |
| 1377 }; | 1379 }; |
| 1378 | 1380 |
| 1379 //----------------------------------------------------------------------------- | 1381 //----------------------------------------------------------------------------- |
| 1380 | 1382 |
| 1381 } // namespace IPC | 1383 } // namespace IPC |
| 1382 | 1384 |
| 1383 #endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_ | 1385 #endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_ |
| 1384 | 1386 |
| OLD | NEW |