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

Side by Side Diff: trunk/src/android_webview/browser/aw_form_database_service.h

Issue 23679005: Revert 221409 "Fix threading issues in aw form database" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_ 5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_
6 #define ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_ 6 #define ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/synchronization/waitable_event.h"
10 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 11 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
11 #include "components/webdata/common/web_data_service_consumer.h" 12 #include "components/webdata/common/web_data_service_consumer.h"
12 #include "components/webdata/common/web_database_service.h" 13 #include "components/webdata/common/web_database_service.h"
13 14
14 namespace base {
15 class WaitableEvent;
16 };
17
18 namespace android_webview { 15 namespace android_webview {
19 16
20 // Handles the database operations necessary to implement the autocomplete 17 // Handles the database operations necessary to implement the autocomplete
21 // functionality. This includes creating and initializing the components that 18 // functionality. This includes creating and initializing the components that
22 // handle the database backend, and providing a synchronous interface when 19 // handle the database backend, and providing a synchronous interface when
23 // needed (the chromium database components have an async. interface). 20 // needed (the chromium database components have an async. interface).
24 class AwFormDatabaseService : public WebDataServiceConsumer { 21 class AwFormDatabaseService : public WebDataServiceConsumer {
25 public: 22 public:
26 AwFormDatabaseService(const base::FilePath path); 23 AwFormDatabaseService(const base::FilePath path);
27 24
(...skipping 10 matching lines...) Expand all
38 35
39 scoped_refptr<autofill::AutofillWebDataService> 36 scoped_refptr<autofill::AutofillWebDataService>
40 get_autofill_webdata_service(); 37 get_autofill_webdata_service();
41 38
42 // WebDataServiceConsumer implementation. 39 // WebDataServiceConsumer implementation.
43 virtual void OnWebDataServiceRequestDone( 40 virtual void OnWebDataServiceRequestDone(
44 WebDataServiceBase::Handle h, 41 WebDataServiceBase::Handle h,
45 const WDTypedResult* result) OVERRIDE; 42 const WDTypedResult* result) OVERRIDE;
46 43
47 private: 44 private:
48 struct PendingQuery { 45 // Cancels the currently pending WebDataService query, if there is one.
49 bool* result; 46 void CancelPendingQuery();
50 base::WaitableEvent* completion;
51 };
52 typedef std::map<WebDataServiceBase::Handle, PendingQuery> QueryMap;
53 47
54 void ClearFormDataImpl(); 48 void HasFormDataImpl();
55 void HasFormDataImpl(base::WaitableEvent* completion, bool* result);
56 49
57 QueryMap result_map_; 50 // Stores the query handle when an async database query is executed.
51 WebDataServiceBase::Handle pending_query_handle_;
52 bool has_form_data_;
53 base::WaitableEvent completion_;
58 54
59 scoped_refptr<autofill::AutofillWebDataService> autofill_data_; 55 scoped_refptr<autofill::AutofillWebDataService> autofill_data_;
60 scoped_refptr<WebDatabaseService> web_database_; 56 scoped_refptr<WebDatabaseService> web_database_;
61 57
62 DISALLOW_COPY_AND_ASSIGN(AwFormDatabaseService); 58 DISALLOW_COPY_AND_ASSIGN(AwFormDatabaseService);
63 }; 59 };
64 60
65 } // namespace android_webview 61 } // namespace android_webview
66 62
67 #endif // ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_ 63 #endif // ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_
OLDNEW
« no previous file with comments | « trunk/src/android_webview/browser/aw_browser_context.cc ('k') | trunk/src/android_webview/browser/aw_form_database_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698