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

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

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 12 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
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 #include "components/safe_json/safe_json_parser_impl.h" 5 #include "components/safe_json/safe_json_parser_impl.h"
6 6
7 #include <utility>
8
7 #include "base/sequenced_task_runner.h" 9 #include "base/sequenced_task_runner.h"
8 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
9 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
10 #include "base/threading/sequenced_task_runner_handle.h" 12 #include "base/threading/sequenced_task_runner_handle.h"
11 #include "base/tuple.h" 13 #include "base/tuple.h"
12 #include "base/values.h" 14 #include "base/values.h"
13 #include "components/safe_json/safe_json_parser_messages.h" 15 #include "components/safe_json/safe_json_parser_messages.h"
14 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/utility_process_host.h" 17 #include "content/public/browser/utility_process_host.h"
16 #include "grit/components_strings.h" 18 #include "grit/components_strings.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 63
62 caller_task_runner_->PostTask( 64 caller_task_runner_->PostTask(
63 FROM_HERE, 65 FROM_HERE,
64 base::Bind(&SafeJsonParserImpl::ReportResultsOnOriginThread, this)); 66 base::Bind(&SafeJsonParserImpl::ReportResultsOnOriginThread, this));
65 } 67 }
66 68
67 void SafeJsonParserImpl::ReportResultsOnOriginThread() { 69 void SafeJsonParserImpl::ReportResultsOnOriginThread() {
68 DCHECK(caller_task_runner_->RunsTasksOnCurrentThread()); 70 DCHECK(caller_task_runner_->RunsTasksOnCurrentThread());
69 if (error_.empty() && parsed_json_) { 71 if (error_.empty() && parsed_json_) {
70 if (!success_callback_.is_null()) 72 if (!success_callback_.is_null())
71 success_callback_.Run(parsed_json_.Pass()); 73 success_callback_.Run(std::move(parsed_json_));
72 } else { 74 } else {
73 if (!error_callback_.is_null()) 75 if (!error_callback_.is_null())
74 error_callback_.Run(error_); 76 error_callback_.Run(error_);
75 } 77 }
76 } 78 }
77 79
78 bool SafeJsonParserImpl::OnMessageReceived(const IPC::Message& message) { 80 bool SafeJsonParserImpl::OnMessageReceived(const IPC::Message& message) {
79 bool handled = true; 81 bool handled = true;
80 IPC_BEGIN_MESSAGE_MAP(SafeJsonParserImpl, message) 82 IPC_BEGIN_MESSAGE_MAP(SafeJsonParserImpl, message)
81 IPC_MESSAGE_HANDLER(SafeJsonParserHostMsg_ParseJSON_Succeeded, 83 IPC_MESSAGE_HANDLER(SafeJsonParserHostMsg_ParseJSON_Succeeded,
82 OnJSONParseSucceeded) 84 OnJSONParseSucceeded)
83 IPC_MESSAGE_HANDLER(SafeJsonParserHostMsg_ParseJSON_Failed, 85 IPC_MESSAGE_HANDLER(SafeJsonParserHostMsg_ParseJSON_Failed,
84 OnJSONParseFailed) 86 OnJSONParseFailed)
85 IPC_MESSAGE_UNHANDLED(handled = false) 87 IPC_MESSAGE_UNHANDLED(handled = false)
86 IPC_END_MESSAGE_MAP() 88 IPC_END_MESSAGE_MAP()
87 return handled; 89 return handled;
88 } 90 }
89 91
90 void SafeJsonParserImpl::Start() { 92 void SafeJsonParserImpl::Start() {
91 caller_task_runner_ = base::SequencedTaskRunnerHandle::Get(); 93 caller_task_runner_ = base::SequencedTaskRunnerHandle::Get();
92 94
93 BrowserThread::PostTask( 95 BrowserThread::PostTask(
94 BrowserThread::IO, FROM_HERE, 96 BrowserThread::IO, FROM_HERE,
95 base::Bind(&SafeJsonParserImpl::StartWorkOnIOThread, this)); 97 base::Bind(&SafeJsonParserImpl::StartWorkOnIOThread, this));
96 } 98 }
97 99
98 } // namespace safe_json 100 } // namespace safe_json
OLDNEW
« no previous file with comments | « components/safe_browsing_db/prefix_set.cc ('k') | components/safe_json/safe_json_parser_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698