OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <mmsystem.h> | 8 #include <mmsystem.h> |
9 | 9 |
10 #include "base/event_recorder.h" | 10 #include "base/event_recorder.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 return EventRecorder::current()->PlaybackWndProc(nCode, wParam, lParam); | 35 return EventRecorder::current()->PlaybackWndProc(nCode, wParam, lParam); |
36 } | 36 } |
37 | 37 |
38 EventRecorder::~EventRecorder() { | 38 EventRecorder::~EventRecorder() { |
39 // Try to assert early if the caller deletes the recorder | 39 // Try to assert early if the caller deletes the recorder |
40 // while it is still in use. | 40 // while it is still in use. |
41 DCHECK(!journal_hook_); | 41 DCHECK(!journal_hook_); |
42 DCHECK(!is_recording_ && !is_playing_); | 42 DCHECK(!is_recording_ && !is_playing_); |
43 } | 43 } |
44 | 44 |
45 bool EventRecorder::StartRecording(const std::wstring& filename) { | 45 bool EventRecorder::StartRecording(const FilePath& filename) { |
46 if (journal_hook_ != NULL) | 46 if (journal_hook_ != NULL) |
47 return false; | 47 return false; |
48 if (is_recording_ || is_playing_) | 48 if (is_recording_ || is_playing_) |
49 return false; | 49 return false; |
50 | 50 |
51 // Open the recording file. | 51 // Open the recording file. |
52 DCHECK(file_ == NULL); | 52 DCHECK(file_ == NULL); |
53 file_ = file_util::OpenFile(filename, "wb+"); | 53 file_ = file_util::OpenFile(filename, "wb+"); |
54 if (!file_) { | 54 if (!file_) { |
55 DLOG(ERROR) << "EventRecorder could not open log file"; | 55 DLOG(ERROR) << "EventRecorder could not open log file"; |
(...skipping 30 matching lines...) Expand all Loading... |
86 | 86 |
87 DCHECK(file_ != NULL); | 87 DCHECK(file_ != NULL); |
88 file_util::CloseFile(file_); | 88 file_util::CloseFile(file_); |
89 file_ = NULL; | 89 file_ = NULL; |
90 | 90 |
91 journal_hook_ = NULL; | 91 journal_hook_ = NULL; |
92 is_recording_ = false; | 92 is_recording_ = false; |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 bool EventRecorder::StartPlayback(const std::wstring& filename) { | 96 bool EventRecorder::StartPlayback(const FilePath& filename) { |
97 if (journal_hook_ != NULL) | 97 if (journal_hook_ != NULL) |
98 return false; | 98 return false; |
99 if (is_recording_ || is_playing_) | 99 if (is_recording_ || is_playing_) |
100 return false; | 100 return false; |
101 | 101 |
102 // Open the recording file. | 102 // Open the recording file. |
103 DCHECK(file_ == NULL); | 103 DCHECK(file_ == NULL); |
104 file_ = file_util::OpenFile(filename, "rb"); | 104 file_ = file_util::OpenFile(filename, "rb"); |
105 if (!file_) { | 105 if (!file_) { |
106 DLOG(ERROR) << "EventRecorder Playback could not open log file"; | 106 DLOG(ERROR) << "EventRecorder Playback could not open log file"; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // indicating that the message is not removed from the message queue after | 250 // indicating that the message is not removed from the message queue after |
251 // PeekMessage processing. | 251 // PeekMessage processing. |
252 case HC_NOREMOVE: | 252 case HC_NOREMOVE: |
253 break; | 253 break; |
254 } | 254 } |
255 | 255 |
256 return CallNextHookEx(journal_hook_, nCode, wParam, lParam); | 256 return CallNextHookEx(journal_hook_, nCode, wParam, lParam); |
257 } | 257 } |
258 | 258 |
259 } // namespace base | 259 } // namespace base |
OLD | NEW |