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

Side by Side Diff: chrome/common/external_ipc_dumper.cc

Issue 2043933002: Move IPC fuzzer switches and helpers from chrome/common to content/common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove CONTENT_EXPORT Created 4 years, 6 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/external_ipc_dumper.h ('k') | chrome/renderer/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/files/file_path.h"
6 #include "base/logging.h"
7 #include "base/native_library.h"
8 #include "base/path_service.h"
9 #include "build/build_config.h"
10 #include "chrome/common/external_ipc_dumper.h"
11
12 typedef IPC::ChannelProxy::OutgoingMessageFilter* (*GetFilterFunction)();
13 typedef void (*SetDumpDirectoryFunction)(const base::FilePath&);
14
15 const char kFilterEntryName[] = "GetFilter";
16 const char kSetDumpDirectoryEntryName[] = "SetDumpDirectory";
17
18 #if defined(OS_WIN)
19 #define IPC_MESSAGE_DUMP_MODULE FILE_PATH_LITERAL("ipc_message_dump.dll")
20 #else
21 #define IPC_MESSAGE_DUMP_MODULE FILE_PATH_LITERAL("libipc_message_dump.so")
22 #endif
23
24 IPC::ChannelProxy::OutgoingMessageFilter* LoadExternalIPCDumper(
25 const base::FilePath& dump_directory) {
26 base::FilePath module_path;
27 if (!PathService::Get(base::DIR_MODULE, &module_path)) {
28 LOG(ERROR) << "Unable to get message dump module directory.";
29 return NULL;
30 }
31
32 base::FilePath library_path = module_path.Append(IPC_MESSAGE_DUMP_MODULE);
33 base::NativeLibraryLoadError load_error;
34 base::NativeLibrary library =
35 base::LoadNativeLibrary(library_path, &load_error);
36
37 if (!library) {
38 LOG(ERROR) << load_error.ToString();
39 return NULL;
40 }
41
42 SetDumpDirectoryFunction set_directory_entry_point =
43 reinterpret_cast<SetDumpDirectoryFunction>(
44 base::GetFunctionPointerFromNativeLibrary(
45 library, kSetDumpDirectoryEntryName));
46 if (!set_directory_entry_point) {
47 LOG(ERROR) << kSetDumpDirectoryEntryName
48 << " not exported by message dump module.";
49 return NULL;
50 }
51 set_directory_entry_point(dump_directory);
52
53 GetFilterFunction filter_entry_point = reinterpret_cast<GetFilterFunction>(
54 base::GetFunctionPointerFromNativeLibrary(library, kFilterEntryName));
55 if (!filter_entry_point) {
56 LOG(ERROR) << kFilterEntryName << " not exported by message dump module.";
57 return NULL;
58 }
59
60 return filter_entry_point();
61 }
OLDNEW
« no previous file with comments | « chrome/common/external_ipc_dumper.h ('k') | chrome/renderer/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698