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

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

Issue 975903002: Add a flag to dump IPC messages sent from the renderer to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove BUILD.gn changes, since the IPC fuzzer doesn't work with gn Created 5 years, 9 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/chrome_content_renderer_client.cc » ('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 "chrome/common/external_ipc_dumper.h"
10
11 typedef IPC::ChannelProxy::OutgoingMessageFilter* (*GetFilterFunction)();
12 typedef void (*SetDumpDirectoryFunction)(const base::FilePath&);
13
14 const char kFilterEntryName[] = "GetFilter";
15 const char kSetDumpDirectoryEntryName[] = "SetDumpDirectory";
16
17 #if defined(OS_WIN)
18 #define IPC_MESSAGE_DUMP_MODULE FILE_PATH_LITERAL("ipc_message_dump.dll")
19 #else
20 #define IPC_MESSAGE_DUMP_MODULE FILE_PATH_LITERAL("libipc_message_dump.so")
21 #endif
22
23 IPC::ChannelProxy::OutgoingMessageFilter* LoadExternalIPCDumper(
24 const base::FilePath& dump_directory) {
25 base::FilePath module_path;
26 if (!PathService::Get(base::DIR_MODULE, &module_path)) {
27 LOG(ERROR) << "Unable to get message dump module directory.";
28 return NULL;
29 }
30
31 base::FilePath library_path = module_path.Append(IPC_MESSAGE_DUMP_MODULE);
32 base::NativeLibraryLoadError load_error;
33 base::NativeLibrary library =
34 base::LoadNativeLibrary(library_path, &load_error);
35
36 if (!library) {
37 LOG(ERROR) << load_error.ToString();
38 return NULL;
39 }
40
41 SetDumpDirectoryFunction set_directory_entry_point =
42 reinterpret_cast<SetDumpDirectoryFunction>(
43 base::GetFunctionPointerFromNativeLibrary(
44 library, kSetDumpDirectoryEntryName));
45 if (!set_directory_entry_point) {
46 LOG(ERROR) << kSetDumpDirectoryEntryName
47 << " not exported by message dump module.";
48 return NULL;
49 }
50 set_directory_entry_point(dump_directory);
51
52 GetFilterFunction filter_entry_point = reinterpret_cast<GetFilterFunction>(
53 base::GetFunctionPointerFromNativeLibrary(library, kFilterEntryName));
54 if (!filter_entry_point) {
55 LOG(ERROR) << kFilterEntryName << " not exported by message dump module.";
56 return NULL;
57 }
58
59 return filter_entry_point();
60 }
OLDNEW
« no previous file with comments | « chrome/common/external_ipc_dumper.h ('k') | chrome/renderer/chrome_content_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698