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

Side by Side Diff: tools/ipc_fuzzer/replay/replay_process.h

Issue 105083002: IPC fuzzer: create message_lib library. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « tools/ipc_fuzzer/replay/replay.gyp ('k') | tools/ipc_fuzzer/replay/replay_process.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 TOOLS_IPC_FUZZER_REPLAY_REPLAY_PROCESS_H_ 5 #ifndef TOOLS_IPC_FUZZER_REPLAY_REPLAY_PROCESS_H_
6 #define TOOLS_IPC_FUZZER_REPLAY_REPLAY_PROCESS_H_ 6 #define TOOLS_IPC_FUZZER_REPLAY_REPLAY_PROCESS_H_
7 7
8 #include <list>
9
10 #include "base/files/memory_mapped_file.h"
11 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
13 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
14 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
15 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
16 #include "ipc/ipc_channel_proxy.h" 13 #include "ipc/ipc_channel_proxy.h"
17 #include "ipc/ipc_listener.h" 14 #include "ipc/ipc_listener.h"
18 #include "ipc/ipc_message.h" 15 #include "ipc/ipc_message.h"
16 #include "tools/ipc_fuzzer/message_lib/message_file.h"
19 17
20 namespace ipc_fuzzer { 18 namespace ipc_fuzzer {
21 19
22 class ReplayProcess : public IPC::Listener { 20 class ReplayProcess : public IPC::Listener {
23 public: 21 public:
24 ReplayProcess(); 22 ReplayProcess();
25 virtual ~ReplayProcess(); 23 virtual ~ReplayProcess();
26 24
27 // Set up command line, logging, IO thread. Returns true on success, false 25 // Set up command line, logging, IO thread. Returns true on success, false
28 // otherwise. 26 // otherwise.
29 bool Initialize(int argc, const char** argv); 27 bool Initialize(int argc, const char** argv);
30 28
31 // Open a channel to the browser process. It will think we are a renderer. 29 // Open a channel to the browser process. It will think we are a renderer.
32 void OpenChannel(); 30 void OpenChannel();
33 31
34 // Extract messages from a file specified by --ipc-fuzzer-testcase= 32 // Extract messages from a file specified by --ipc-fuzzer-testcase=
35 // Returns true on success, false otherwise. 33 // Returns true on success, false otherwise.
36 bool OpenTestcase(); 34 bool OpenTestcase();
37 35
38 // Send messages to the browser. 36 // Send messages to the browser.
39 void Run(); 37 void Run();
40 38
41 // IPC::Listener implementation. 39 // IPC::Listener implementation.
42 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 40 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
43 virtual void OnChannelError() OVERRIDE; 41 virtual void OnChannelError() OVERRIDE;
44 42
45 private: 43 private:
46 bool ExtractMessages(const char *data, size_t len);
47 void SendNextMessage(); 44 void SendNextMessage();
48 45
49 scoped_ptr<IPC::ChannelProxy> channel_; 46 scoped_ptr<IPC::ChannelProxy> channel_;
50 base::MessageLoop main_loop_; 47 base::MessageLoop main_loop_;
51 base::Thread io_thread_; 48 base::Thread io_thread_;
52 base::WaitableEvent shutdown_event_; 49 base::WaitableEvent shutdown_event_;
53 scoped_ptr<base::Timer> timer_; 50 scoped_ptr<base::Timer> timer_;
54 scoped_ptr<base::MemoryMappedFile> mapped_testcase_; 51 MessageVector messages_;
55 std::list<IPC::Message*> messages_; 52 size_t message_index_;
56 53
57 DISALLOW_COPY_AND_ASSIGN(ReplayProcess); 54 DISALLOW_COPY_AND_ASSIGN(ReplayProcess);
58 }; 55 };
59 56
60 } // namespace ipc_fuzzer 57 } // namespace ipc_fuzzer
61 58
62 #endif // TOOLS_IPC_FUZZER_REPLAY_REPLAY_PROCESS_H_ 59 #endif // TOOLS_IPC_FUZZER_REPLAY_REPLAY_PROCESS_H_
OLDNEW
« no previous file with comments | « tools/ipc_fuzzer/replay/replay.gyp ('k') | tools/ipc_fuzzer/replay/replay_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698