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

Side by Side Diff: components/safe_json/safe_json_parser_impl.h

Issue 2803023005: Switch base::Value typemapping to be by value instead of by unique_ptr.
Patch Set: Created 3 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 | « chrome/utility/profile_import_handler.cc ('k') | components/safe_json/safe_json_parser_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 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 COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_IMPL_H_ 5 #ifndef COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_IMPL_H_
6 #define COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_IMPL_H_ 6 #define COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 21 matching lines...) Expand all
32 private: 32 private:
33 ~SafeJsonParserImpl() override; 33 ~SafeJsonParserImpl() override;
34 34
35 // SafeJsonParser implementation. 35 // SafeJsonParser implementation.
36 void Start() override; 36 void Start() override;
37 37
38 void StartOnIOThread(); 38 void StartOnIOThread();
39 void OnConnectionError(); 39 void OnConnectionError();
40 40
41 // mojom::SafeJsonParser::Parse callback. 41 // mojom::SafeJsonParser::Parse callback.
42 void OnParseDone(std::unique_ptr<base::Value> result, 42 void OnParseDone(const base::Optional<base::Value>& result,
43 const base::Optional<std::string>& error); 43 const base::Optional<std::string>& error);
44 44
45 // Reports the result on the calling task runner via the |success_callback_| 45 // Reports the result on the calling task runner via the |success_callback_|
46 // or the |error_callback_|. 46 // or the |error_callback_|.
47 void ReportResults(std::unique_ptr<base::Value> parsed_json, 47 void ReportResults(std::unique_ptr<base::Value> parsed_json,
48 const std::string& error); 48 const std::string& error);
49 49
50 const std::string unsafe_json_; 50 const std::string unsafe_json_;
51 SuccessCallback success_callback_; 51 SuccessCallback success_callback_;
52 ErrorCallback error_callback_; 52 ErrorCallback error_callback_;
53 scoped_refptr<base::SequencedTaskRunner> caller_task_runner_; 53 scoped_refptr<base::SequencedTaskRunner> caller_task_runner_;
54 54
55 std::unique_ptr<content::UtilityProcessMojoClient<mojom::SafeJsonParser>> 55 std::unique_ptr<content::UtilityProcessMojoClient<mojom::SafeJsonParser>>
56 mojo_json_parser_; 56 mojo_json_parser_;
57 57
58 // Used instead of DCHECK_CURRENTLY_ON(BrowserThread::IO) because it's 58 // Used instead of DCHECK_CURRENTLY_ON(BrowserThread::IO) because it's
59 // posssible that it fails when the IO thread message loop is shutting down. 59 // posssible that it fails when the IO thread message loop is shutting down.
60 // This happens after the IO thread has unregistered from the BrowserThread 60 // This happens after the IO thread has unregistered from the BrowserThread
61 // list. 61 // list.
62 base::ThreadChecker io_thread_checker_; 62 base::ThreadChecker io_thread_checker_;
63 63
64 DISALLOW_COPY_AND_ASSIGN(SafeJsonParserImpl); 64 DISALLOW_COPY_AND_ASSIGN(SafeJsonParserImpl);
65 }; 65 };
66 66
67 } // namespace safe_json 67 } // namespace safe_json
68 68
69 #endif // COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_IMPL_H_ 69 #endif // COMPONENTS_SAFE_JSON_SAFE_JSON_PARSER_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/utility/profile_import_handler.cc ('k') | components/safe_json/safe_json_parser_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698