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

Side by Side Diff: mojo/shell/in_process_dynamic_service_runner.cc

Issue 206713004: Report PPAPI plugin load error code to UMA. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use std::string directly. Created 6 years, 9 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 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/shell/in_process_dynamic_service_runner.h" 5 #include "mojo/shell/in_process_dynamic_service_runner.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 void InProcessDynamicServiceRunner::Run() { 44 void InProcessDynamicServiceRunner::Run() {
45 DVLOG(2) << "Loading/running Mojo app from " << app_path_.value() 45 DVLOG(2) << "Loading/running Mojo app from " << app_path_.value()
46 << " in process"; 46 << " in process";
47 47
48 base::ScopedClosureRunner app_deleter( 48 base::ScopedClosureRunner app_deleter(
49 base::Bind(base::IgnoreResult(&base::DeleteFile), app_path_, false)); 49 base::Bind(base::IgnoreResult(&base::DeleteFile), app_path_, false));
50 50
51 do { 51 do {
52 std::string load_error; 52 base::NativeLibraryLoadError load_error = 0;
53 base::ScopedNativeLibrary app_library( 53 base::ScopedNativeLibrary app_library(
54 base::LoadNativeLibrary(app_path_, &load_error)); 54 base::LoadNativeLibrary(app_path_, &load_error));
55 if (!app_library.is_valid()) { 55 if (!app_library.is_valid()) {
56 LOG(ERROR) << "Failed to load library (error: " << load_error << ")"; 56 LOG(ERROR) << "Failed to load library (error: " << load_error << ")";
57 break; 57 break;
58 } 58 }
59 59
60 typedef MojoResult (*MojoMainFunction)(MojoHandle); 60 typedef MojoResult (*MojoMainFunction)(MojoHandle);
61 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>( 61 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>(
62 app_library.GetFunctionPointer("MojoMain")); 62 app_library.GetFunctionPointer("MojoMain"));
63 if (!main_function) { 63 if (!main_function) {
64 LOG(ERROR) << "Entrypoint MojoMain not found"; 64 LOG(ERROR) << "Entrypoint MojoMain not found";
65 break; 65 break;
66 } 66 }
67 67
68 // |MojoMain()| takes ownership of the service handle. 68 // |MojoMain()| takes ownership of the service handle.
69 MojoResult result = main_function(service_handle_.release().value()); 69 MojoResult result = main_function(service_handle_.release().value());
70 if (result < MOJO_RESULT_OK) 70 if (result < MOJO_RESULT_OK)
71 LOG(ERROR) << "MojoMain returned an error: " << result; 71 LOG(ERROR) << "MojoMain returned an error: " << result;
72 } while (false); 72 } while (false);
73 73
74 app_completed_callback_.Run(); 74 app_completed_callback_.Run();
75 app_completed_callback_.Reset(); 75 app_completed_callback_.Reset();
76 } 76 }
77 77
78 } // namespace shell 78 } // namespace shell
79 } // namespace mojo 79 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698