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

Unified Diff: ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc

Issue 235983020: Pepper: Move PnaclOptions outside trusted plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: another build fix Created 6 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc
index 7cb98b839872eb64eee8a47bb8e34ebea0432206..27ce23acaed102e937b0a7fd3279a03fff60f3d2 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc
@@ -15,6 +15,29 @@
#include "ppapi/native_client/src/trusted/plugin/utility.h"
namespace plugin {
+namespace {
+
+std::vector<char> GetOptCommandLine(int32_t opt_level, bool is_debug) {
+ std::vector<char> result;
+ nacl::string str;
+
+ nacl::stringstream ss;
+ ss << "-O" << opt_level;
+ str = ss.str();
+ std::copy(str.begin(), str.end(), std::back_inserter(result));
+ result.push_back('\x00');
+ // Debug info is only available in LLVM format pexes,
+ // not in PNaCl format pexes.
+ if (is_debug) {
+ str = "-bitcode-format=llvm";
+ std::copy(str.begin(), str.end(), std::back_inserter(result));
+ result.push_back('\x00');
dmichael (off chromium) 2014/04/15 23:15:04 This all looks a little more complicated than it n
+ }
+
+ return result;
+}
+
+} // namespace
PnaclTranslateThread::PnaclTranslateThread() : llc_subprocess_active_(false),
ld_subprocess_active_(false),
@@ -40,7 +63,7 @@ void PnaclTranslateThread::RunTranslate(
nacl::DescWrapper* invalid_desc_wrapper,
ErrorInfo* error_info,
PnaclResources* resources,
- PnaclOptions* pnacl_options,
+ PP_PNaClOptions* pnacl_options,
PnaclCoordinator* coordinator,
Plugin* plugin) {
PLUGIN_PRINTF(("PnaclStreamingTranslateThread::RunTranslate)\n"));
@@ -187,7 +210,8 @@ void PnaclTranslateThread::DoTranslate() {
nacl::string split_arg = ss.str();
std::copy(split_arg.begin(), split_arg.end(), std::back_inserter(split_args));
split_args.push_back('\x00');
- std::vector<char> options = pnacl_options_->GetOptCommandline();
+ std::vector<char> options = GetOptCommandLine(pnacl_options_->opt_level,
+ pnacl_options_->is_debug);
std::copy(options.begin(), options.end(), std::back_inserter(split_args));
init_success = llc_subprocess_->InvokeSrpcMethod(
"StreamInitWithSplit",

Powered by Google App Engine
This is Rietveld 408576698