- add sources.
[platform/framework/web/crosswalk.git] / src / ppapi / native_client / src / trusted / plugin / pnacl_options.cc
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() : translate_(false), opt_level_(2) { }
15
16 PnaclOptions::~PnaclOptions() {
17 }
18
19 void PnaclOptions::set_opt_level(int32_t l) {
20   if (l <= 0) {
21     opt_level_ = 0;
22     return;
23   }
24   // Currently only allow 0 or 2, since that is what we test.
25   opt_level_ = 2;
26 }
27
28 std::vector<char> PnaclOptions::GetOptCommandline() const {
29   std::vector<char> result;
30   nacl::string str;
31
32   nacl::stringstream ss;
33   ss << "-O" << opt_level_;
34   str = ss.str();
35
36   std::copy(str.begin(), str.end(), std::back_inserter(result));
37   result.push_back('\x00');
38
39   return result;
40 }
41
42 }  // namespace plugin