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

Side by Side Diff: chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.h

Issue 24325002: Fix threading bug in the brlapi braille controller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 7 years, 2 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 | chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.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 CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROLLER _BRLAPI_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROLLER _BRLAPI_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROLLER _BRLAPI_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROLLER _BRLAPI_H_
7 7
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_path_watcher.h" 9 #include "base/files/file_path_watcher.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 void SetCreateBrlapiConnectionForTesting( 45 void SetCreateBrlapiConnectionForTesting(
46 const CreateBrlapiConnectionFunction& callback); 46 const CreateBrlapiConnectionFunction& callback);
47 47
48 // Makes the controller try to reconnect (if disconnected) as if the brlapi 48 // Makes the controller try to reconnect (if disconnected) as if the brlapi
49 // socket directory had changed. 49 // socket directory had changed.
50 void PokeSocketDirForTesting(); 50 void PokeSocketDirForTesting();
51 51
52 // Tries to connect and starts watching for new brlapi servers. 52 // Tries to connect and starts watching for new brlapi servers.
53 // No-op if already called. 53 // No-op if already called.
54 void StartConnecting(); 54 void StartConnecting();
55 void OnSocketDirChanged(const base::FilePath& path, bool error); 55 void StartWatchingSocketDirOnFileThread();
56 void OnSocketDirChangedOnFileThread(const base::FilePath& path, bool error);
57 void OnSocketDirChangedOnIOThread();
56 void TryToConnect(); 58 void TryToConnect();
57 void ResetRetryConnectHorizon(); 59 void ResetRetryConnectHorizon();
58 void ScheduleTryToConnect(); 60 void ScheduleTryToConnect();
59 void Disconnect(); 61 void Disconnect();
60 scoped_ptr<BrlapiConnection> CreateBrlapiConnection(); 62 scoped_ptr<BrlapiConnection> CreateBrlapiConnection();
61 void DispatchKeys(); 63 void DispatchKeys();
62 scoped_ptr<KeyEvent> MapKeyCode(brlapi_keyCode_t code); 64 scoped_ptr<KeyEvent> MapKeyCode(brlapi_keyCode_t code);
63 void DispatchKeyEvent(scoped_ptr<KeyEvent> event); 65 void DispatchKeyEvent(scoped_ptr<KeyEvent> event);
64 void DispatchOnDisplayStateChanged(scoped_ptr<DisplayState> new_state); 66 void DispatchOnDisplayStateChanged(scoped_ptr<DisplayState> new_state);
65 67
66 LibBrlapiLoader libbrlapi_loader_;
67 CreateBrlapiConnectionFunction create_brlapi_connection_function_; 68 CreateBrlapiConnectionFunction create_brlapi_connection_function_;
68 69
69 // Manipulated on the IO thread. 70 // Manipulated on the IO thread.
71 LibBrlapiLoader libbrlapi_loader_;
70 scoped_ptr<BrlapiConnection> connection_; 72 scoped_ptr<BrlapiConnection> connection_;
71 base::FilePathWatcher file_path_watcher_;
72 bool started_connecting_; 73 bool started_connecting_;
73 bool connect_scheduled_; 74 bool connect_scheduled_;
74 base::Time retry_connect_horizon_; 75 base::Time retry_connect_horizon_;
75 76
76 // Manipulated on the UI thread. 77 // Manipulated on the UI thread.
77 ObserverList<BrailleObserver> observers_; 78 ObserverList<BrailleObserver> observers_;
78 79
80 // Manipulated on the FILE thread.
81 base::FilePathWatcher file_path_watcher_;
82
79 friend struct DefaultSingletonTraits<BrailleControllerImpl>; 83 friend struct DefaultSingletonTraits<BrailleControllerImpl>;
80 84
81 DISALLOW_COPY_AND_ASSIGN(BrailleControllerImpl); 85 DISALLOW_COPY_AND_ASSIGN(BrailleControllerImpl);
82 }; 86 };
83 87
84 } // namespace braille_display_private 88 } // namespace braille_display_private
85 } // namespace api 89 } // namespace api
86 } // namespace extensions 90 } // namespace extensions
87 91
88 #endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROL LER_BRLAPI_H_ 92 #endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROL LER_BRLAPI_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698