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

Side by Side Diff: ppapi/native_client/src/trusted/plugin/pnacl_options.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/native_client/src/trusted/plugin/pnacl_options.h"
6
7 #include <iterator>
8 #include <vector>
9
10 #include "native_client/src/include/nacl_string.h"
11
12 namespace plugin {
13
14 PnaclOptions::PnaclOptions()
15 : translate_(false),
16 is_debug_(false),
17 opt_level_(2) {
18 }
19
20 PnaclOptions::~PnaclOptions() {
21 }
22
23 void PnaclOptions::set_opt_level(int32_t l) {
24 if (l <= 0) {
25 opt_level_ = 0;
26 return;
27 }
28 // Currently only allow 0 or 2, since that is what we test.
29 opt_level_ = 2;
30 }
31
32 std::vector<char> PnaclOptions::GetOptCommandline() const {
33 std::vector<char> result;
34 nacl::string str;
35
36 nacl::stringstream ss;
37 ss << "-O" << opt_level_;
38 str = ss.str();
39 std::copy(str.begin(), str.end(), std::back_inserter(result));
40 result.push_back('\x00');
41 // Debug info is only available in LLVM format pexes,
42 // not in PNaCl format pexes.
43 if (is_debug_) {
44 str = "-bitcode-format=llvm";
45 std::copy(str.begin(), str.end(), std::back_inserter(result));
46 result.push_back('\x00');
47 }
48
49 return result;
50 }
51
52 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698