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

Side by Side Diff: mojo/runner/android/android_handler.cc

Issue 1552973002: Convert Pass()→std::move() in //mojo/runner/android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | mojo/runner/android/android_handler_loader.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/runner/android/android_handler.h" 5 #include "mojo/runner/android/android_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility>
8 9
9 #include "base/android/context_utils.h" 10 #include "base/android/context_utils.h"
10 #include "base/android/jni_android.h" 11 #include "base/android/jni_android.h"
11 #include "base/android/jni_string.h" 12 #include "base/android/jni_string.h"
12 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/scoped_native_library.h" 15 #include "base/scoped_native_library.h"
15 #include "jni/AndroidHandler_jni.h" 16 #include "jni/AndroidHandler_jni.h"
16 #include "mojo/application/public/cpp/application_impl.h" 17 #include "mojo/application/public/cpp/application_impl.h"
17 #include "mojo/common/data_pipe_utils.h" 18 #include "mojo/common/data_pipe_utils.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 InitApplicationContextFn init_application_context = 61 InitApplicationContextFn init_application_context =
61 reinterpret_cast<InitApplicationContextFn>( 62 reinterpret_cast<InitApplicationContextFn>(
62 base::GetFunctionPointerFromNativeLibrary( 63 base::GetFunctionPointerFromNativeLibrary(
63 app_library, init_application_context_name)); 64 app_library, init_application_context_name));
64 if (init_application_context) { 65 if (init_application_context) {
65 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, j_context); 66 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, j_context);
66 init_application_context(scoped_context); 67 init_application_context(scoped_context);
67 } 68 }
68 69
69 // Run the application. 70 // Run the application.
70 RunNativeApplication(app_library, application_request.Pass()); 71 RunNativeApplication(app_library, std::move(application_request));
71 // TODO(vtl): See note about unloading and thread-local destructors above 72 // TODO(vtl): See note about unloading and thread-local destructors above
72 // declaration of |LoadNativeApplication()|. 73 // declaration of |LoadNativeApplication()|.
73 base::UnloadNativeLibrary(app_library); 74 base::UnloadNativeLibrary(app_library);
74 } 75 }
75 76
76 // Returns true if |url| denotes a cached app. If true |app_dir| is set to the 77 // Returns true if |url| denotes a cached app. If true |app_dir| is set to the
77 // path of the directory for the app and |path_to_mojo| the path of the app's 78 // path of the directory for the app and |path_to_mojo| the path of the app's
78 // .mojo file. 79 // .mojo file.
79 bool IsCachedApp(JNIEnv* env, 80 bool IsCachedApp(JNIEnv* env,
80 const GURL& url, 81 const GURL& url,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 application_request.PassMessagePipe().release().value(), 153 application_request.PassMessagePipe().release().value(),
153 reinterpret_cast<jlong>(run_android_application_fn)); 154 reinterpret_cast<jlong>(run_android_application_fn));
154 return; 155 return;
155 } 156 }
156 } 157 }
157 ScopedJavaLocalRef<jstring> j_archive_path = 158 ScopedJavaLocalRef<jstring> j_archive_path =
158 Java_AndroidHandler_getNewTempArchivePath(env, GetApplicationContext()); 159 Java_AndroidHandler_getNewTempArchivePath(env, GetApplicationContext());
159 base::FilePath archive_path( 160 base::FilePath archive_path(
160 ConvertJavaStringToUTF8(env, j_archive_path.obj())); 161 ConvertJavaStringToUTF8(env, j_archive_path.obj()));
161 162
162 common::BlockingCopyToFile(response->body.Pass(), archive_path); 163 common::BlockingCopyToFile(std::move(response->body), archive_path);
163 Java_AndroidHandler_bootstrap( 164 Java_AndroidHandler_bootstrap(
164 env, GetApplicationContext(), j_archive_path.obj(), 165 env, GetApplicationContext(), j_archive_path.obj(),
165 application_request.PassMessagePipe().release().value(), 166 application_request.PassMessagePipe().release().value(),
166 reinterpret_cast<jlong>(run_android_application_fn)); 167 reinterpret_cast<jlong>(run_android_application_fn));
167 } 168 }
168 169
169 void AndroidHandler::Initialize(ApplicationImpl* app) { 170 void AndroidHandler::Initialize(ApplicationImpl* app) {
170 } 171 }
171 172
172 bool AndroidHandler::ConfigureIncomingConnection( 173 bool AndroidHandler::ConfigureIncomingConnection(
173 ApplicationConnection* connection) { 174 ApplicationConnection* connection) {
174 connection->AddService(&content_handler_factory_); 175 connection->AddService(&content_handler_factory_);
175 return true; 176 return true;
176 } 177 }
177 178
178 bool RegisterAndroidHandlerJni(JNIEnv* env) { 179 bool RegisterAndroidHandlerJni(JNIEnv* env) {
179 return RegisterNativesImpl(env); 180 return RegisterNativesImpl(env);
180 } 181 }
181 182
182 } // namespace runner 183 } // namespace runner
183 } // namespace mojo 184 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/runner/android/android_handler_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698