| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 #include "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/native_library.h" | 7 #include "base/native_library.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/common/external_ipc_dumper.h" | 10 #include "content/common/external_ipc_dumper.h" |
| 11 |
| 12 namespace { |
| 11 | 13 |
| 12 typedef IPC::ChannelProxy::OutgoingMessageFilter* (*GetFilterFunction)(); | 14 typedef IPC::ChannelProxy::OutgoingMessageFilter* (*GetFilterFunction)(); |
| 13 typedef void (*SetDumpDirectoryFunction)(const base::FilePath&); | 15 typedef void (*SetDumpDirectoryFunction)(const base::FilePath&); |
| 14 | 16 |
| 15 const char kFilterEntryName[] = "GetFilter"; | 17 const char kFilterEntryName[] = "GetFilter"; |
| 16 const char kSetDumpDirectoryEntryName[] = "SetDumpDirectory"; | 18 const char kSetDumpDirectoryEntryName[] = "SetDumpDirectory"; |
| 17 | 19 |
| 18 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
| 19 #define IPC_MESSAGE_DUMP_MODULE FILE_PATH_LITERAL("ipc_message_dump.dll") | 21 #define IPC_MESSAGE_DUMP_MODULE FILE_PATH_LITERAL("ipc_message_dump.dll") |
| 20 #else | 22 #else |
| 21 #define IPC_MESSAGE_DUMP_MODULE FILE_PATH_LITERAL("libipc_message_dump.so") | 23 #define IPC_MESSAGE_DUMP_MODULE FILE_PATH_LITERAL("libipc_message_dump.so") |
| 22 #endif | 24 #endif |
| 23 | 25 |
| 26 } // namespace |
| 27 |
| 28 namespace content { |
| 29 |
| 24 IPC::ChannelProxy::OutgoingMessageFilter* LoadExternalIPCDumper( | 30 IPC::ChannelProxy::OutgoingMessageFilter* LoadExternalIPCDumper( |
| 25 const base::FilePath& dump_directory) { | 31 const base::FilePath& dump_directory) { |
| 26 base::FilePath module_path; | 32 base::FilePath module_path; |
| 27 if (!PathService::Get(base::DIR_MODULE, &module_path)) { | 33 if (!PathService::Get(base::DIR_MODULE, &module_path)) { |
| 28 LOG(ERROR) << "Unable to get message dump module directory."; | 34 LOG(ERROR) << "Unable to get message dump module directory."; |
| 29 return NULL; | 35 return NULL; |
| 30 } | 36 } |
| 31 | 37 |
| 32 base::FilePath library_path = module_path.Append(IPC_MESSAGE_DUMP_MODULE); | 38 base::FilePath library_path = module_path.Append(IPC_MESSAGE_DUMP_MODULE); |
| 33 base::NativeLibraryLoadError load_error; | 39 base::NativeLibraryLoadError load_error; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 52 | 58 |
| 53 GetFilterFunction filter_entry_point = reinterpret_cast<GetFilterFunction>( | 59 GetFilterFunction filter_entry_point = reinterpret_cast<GetFilterFunction>( |
| 54 base::GetFunctionPointerFromNativeLibrary(library, kFilterEntryName)); | 60 base::GetFunctionPointerFromNativeLibrary(library, kFilterEntryName)); |
| 55 if (!filter_entry_point) { | 61 if (!filter_entry_point) { |
| 56 LOG(ERROR) << kFilterEntryName << " not exported by message dump module."; | 62 LOG(ERROR) << kFilterEntryName << " not exported by message dump module."; |
| 57 return NULL; | 63 return NULL; |
| 58 } | 64 } |
| 59 | 65 |
| 60 return filter_entry_point(); | 66 return filter_entry_point(); |
| 61 } | 67 } |
| 68 |
| 69 } // namespace content |
| OLD | NEW |