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

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

Issue 106163003: Refactor IPC fuzzer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
Tom Sepez 2013/12/05 19:05:49 Please put an include guard macro in this file.
aedla 2013/12/05 23:16:21 Good catch.
5 #include <list>
6
7 #include "base/files/memory_mapped_file.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h"
10 #include "base/synchronization/waitable_event.h"
11 #include "base/threading/thread.h"
12 #include "base/timer/timer.h"
13 #include "ipc/ipc_channel_proxy.h"
14 #include "ipc/ipc_listener.h"
15 #include "ipc/ipc_message.h"
16
17 namespace ipc_fuzzer {
18
19 class ReplayProcess : public IPC::Listener {
20 public:
21 ReplayProcess();
22 virtual ~ReplayProcess();
23
24 // Set up command line, logging, IO thread.
25 void Initialize(int argc, const char **argv);
Tom Sepez 2013/12/05 19:05:49 nit: probably needs to be a bool to fail execution
aedla 2013/12/05 23:16:21 Done.
26
27 // Open a channel to the browser process. It will think we are a renderer.
28 void OpenChannel();
Tom Sepez 2013/12/05 19:05:49 Nit: probably needs to be a bool to return status.
aedla 2013/12/05 23:16:21 OpenChannel() can't really fail. Wrote a bit longe
29
30 // Extract messages from a file specified by --ipc-fuzzer-testcase=.
31 bool OpenTestcase();
Tom Sepez 2013/12/05 19:05:49 Nit: // returns true on success, false otherwise.
aedla 2013/12/05 23:16:21 Done.
32
33 // Send messages to the browser.
34 void Run();
35
36 // IPC::Listener implementation.
37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
38 virtual void OnChannelError() OVERRIDE;
39
40 private:
41 bool ExtractMessages(const char *data, size_t len);
42 void SendNextMessage();
43
44 scoped_ptr<IPC::ChannelProxy> channel_;
45 base::MessageLoop main_loop_;
46 base::Thread io_thread_;
47 base::WaitableEvent shutdown_event_;
48 scoped_ptr<base::Timer> timer_;
49 scoped_ptr<base::MemoryMappedFile> testcase_map_;
Tom Sepez 2013/12/05 19:05:49 nit: testcase_mapped_file_, otherwise the name sou
aedla 2013/12/05 23:16:21 Went with mapped_testcase_.
50 std::list<IPC::Message*> messages_;
51
52 DISALLOW_COPY_AND_ASSIGN(ReplayProcess);
53 };
54
55 } // namespace ipc_fuzzer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698