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

Side by Side Diff: remoting/host/security_key/remote_security_key_message_reader_impl.h

Issue 1900733002: Fixing a Dr. Memory hang in the remoting_unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing CR feedback Created 4 years, 8 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 | « no previous file | remoting/host/security_key/remote_security_key_message_reader_impl.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_IMPL_H_ 5 #ifndef REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_IMPL_H_
6 #define REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_IMPL_H_ 6 #define REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 20 matching lines...) Expand all
31 31
32 // RemoteSecurityKeyMessageReader interface. 32 // RemoteSecurityKeyMessageReader interface.
33 void Start(const SecurityKeyMessageCallback& message_callback, 33 void Start(const SecurityKeyMessageCallback& message_callback,
34 const base::Closure& error_callback) override; 34 const base::Closure& error_callback) override;
35 35
36 private: 36 private:
37 // Reads a message from the remote security key process and passes it to 37 // Reads a message from the remote security key process and passes it to
38 // |message_callback_| on the originating thread. Run on |read_task_runner_|. 38 // |message_callback_| on the originating thread. Run on |read_task_runner_|.
39 void ReadMessage(); 39 void ReadMessage();
40 40
41 // Reads the nubmer of bytes indicated by |bytes_to_read| into |buffer| from
42 // |read_stream_|. Returns true if all bytes were retrieved successfully.
43 bool ReadFromStream(char* buffer, size_t bytes_to_read);
44
41 // Callback run on |read_task_runner_| when an error occurs or EOF is reached. 45 // Callback run on |read_task_runner_| when an error occurs or EOF is reached.
42 void NotifyError(); 46 void NotifyError();
43 47
44 // Used for callbacks on the appropriate task runner to signal status changes. 48 // Used for callbacks on the appropriate task runner to signal status changes.
45 // These callbacks are invoked on |main_task_runner_|. 49 // These callbacks are invoked on |main_task_runner_|.
46 void InvokeMessageCallback(std::unique_ptr<SecurityKeyMessage> message); 50 void InvokeMessageCallback(std::unique_ptr<SecurityKeyMessage> message);
47 void InvokeErrorCallback(); 51 void InvokeErrorCallback();
48 52
49 base::File read_stream_; 53 base::File read_stream_;
50 54
51 // Caller-supplied message and error callbacks. 55 // Caller-supplied message and error callbacks.
52 SecurityKeyMessageCallback message_callback_; 56 SecurityKeyMessageCallback message_callback_;
53 base::Closure error_callback_; 57 base::Closure error_callback_;
54 58
55 // Thread used for blocking IO operations. 59 // Thread used for blocking IO operations.
56 base::Thread reader_thread_; 60 base::Thread reader_thread_;
57 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; 61 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
58 scoped_refptr<base::SingleThreadTaskRunner> read_task_runner_; 62 scoped_refptr<base::SingleThreadTaskRunner> read_task_runner_;
59 63
60 base::WeakPtr<RemoteSecurityKeyMessageReaderImpl> reader_; 64 base::WeakPtr<RemoteSecurityKeyMessageReaderImpl> reader_;
61 base::WeakPtrFactory<RemoteSecurityKeyMessageReaderImpl> weak_factory_; 65 base::WeakPtrFactory<RemoteSecurityKeyMessageReaderImpl> weak_factory_;
62 66
63 DISALLOW_COPY_AND_ASSIGN(RemoteSecurityKeyMessageReaderImpl); 67 DISALLOW_COPY_AND_ASSIGN(RemoteSecurityKeyMessageReaderImpl);
64 }; 68 };
65 69
66 } // namespace remoting 70 } // namespace remoting
67 71
68 #endif // REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_IMPL_H_ 72 #endif // REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/host/security_key/remote_security_key_message_reader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698