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

Side by Side Diff: ppapi/native_client/src/trusted/plugin/plugin.cc

Issue 250063003: Pepper: Move IME workaround from the trusted plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile error 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
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/plugin.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifdef _MSC_VER 5 #ifdef _MSC_VER
6 // Do not warn about use of std::copy with raw pointers. 6 // Do not warn about use of std::copy with raw pointers.
7 #pragma warning(disable : 4996) 7 #pragma warning(disable : 4996)
8 #endif 8 #endif
9 9
10 #include "ppapi/native_client/src/trusted/plugin/plugin.h" 10 #include "ppapi/native_client/src/trusted/plugin/plugin.h"
(...skipping 15 matching lines...) Expand all
26 #include "native_client/src/shared/platform/nacl_check.h" 26 #include "native_client/src/shared/platform/nacl_check.h"
27 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" 27 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
28 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" 28 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h"
29 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" 29 #include "native_client/src/trusted/service_runtime/nacl_error_code.h"
30 30
31 #include "ppapi/c/pp_errors.h" 31 #include "ppapi/c/pp_errors.h"
32 #include "ppapi/c/ppb_var.h" 32 #include "ppapi/c/ppb_var.h"
33 #include "ppapi/c/private/ppb_nacl_private.h" 33 #include "ppapi/c/private/ppb_nacl_private.h"
34 #include "ppapi/cpp/dev/url_util_dev.h" 34 #include "ppapi/cpp/dev/url_util_dev.h"
35 #include "ppapi/cpp/module.h" 35 #include "ppapi/cpp/module.h"
36 #include "ppapi/cpp/text_input_controller.h"
37 36
38 #include "ppapi/native_client/src/trusted/plugin/file_utils.h" 37 #include "ppapi/native_client/src/trusted/plugin/file_utils.h"
39 #include "ppapi/native_client/src/trusted/plugin/json_manifest.h" 38 #include "ppapi/native_client/src/trusted/plugin/json_manifest.h"
40 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h" 39 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h"
41 #include "ppapi/native_client/src/trusted/plugin/nacl_subprocess.h" 40 #include "ppapi/native_client/src/trusted/plugin/nacl_subprocess.h"
42 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" 41 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h"
43 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" 42 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h"
44 #include "ppapi/native_client/src/trusted/plugin/utility.h" 43 #include "ppapi/native_client/src/trusted/plugin/utility.h"
45 44
46 namespace plugin { 45 namespace plugin {
(...skipping 11 matching lines...) Expand all
58 const int64_t kTimeSmallMin = 1; // in ms 57 const int64_t kTimeSmallMin = 1; // in ms
59 const int64_t kTimeSmallMax = 20000; // in ms 58 const int64_t kTimeSmallMax = 20000; // in ms
60 const uint32_t kTimeSmallBuckets = 100; 59 const uint32_t kTimeSmallBuckets = 100;
61 60
62 const int64_t kSizeKBMin = 1; 61 const int64_t kSizeKBMin = 1;
63 const int64_t kSizeKBMax = 512*1024; // very large .nexe 62 const int64_t kSizeKBMax = 512*1024; // very large .nexe
64 const uint32_t kSizeKBBuckets = 100; 63 const uint32_t kSizeKBBuckets = 100;
65 64
66 } // namespace 65 } // namespace
67 66
68 bool Plugin::EarlyInit() {
69 PLUGIN_PRINTF(("Plugin::EarlyInit (instance=%p)\n",
70 static_cast<void*>(this)));
71
72 #ifdef NACL_OSX
73 // TODO(kochi): For crbug.com/102808, this is a stopgap solution for Lion
74 // until we expose IME API to .nexe. This disables any IME interference
75 // against key inputs, so you cannot use off-the-spot IME input for NaCl apps.
76 // This makes discrepancy among platforms and therefore we should remove
77 // this hack when IME API is made available.
78 // The default for non-Mac platforms is still off-the-spot IME mode.
79 pp::TextInputController(this).SetTextInputType(PP_TEXTINPUT_TYPE_NONE);
80 #endif
81
82 // Set up the factory used to produce DescWrappers.
83 wrapper_factory_ = new nacl::DescWrapperFactory();
84 if (NULL == wrapper_factory_) {
85 return false;
86 }
87 PLUGIN_PRINTF(("Plugin::Init (wrapper_factory=%p)\n",
88 static_cast<void*>(wrapper_factory_)));
89
90 PLUGIN_PRINTF(("Plugin::Init (return 1)\n"));
91 // Return success.
92 return true;
93 }
94
95 void Plugin::ShutDownSubprocesses() { 67 void Plugin::ShutDownSubprocesses() {
96 PLUGIN_PRINTF(("Plugin::ShutDownSubprocesses (this=%p)\n", 68 PLUGIN_PRINTF(("Plugin::ShutDownSubprocesses (this=%p)\n",
97 static_cast<void*>(this))); 69 static_cast<void*>(this)));
98 PLUGIN_PRINTF(("Plugin::ShutDownSubprocesses (%s)\n", 70 PLUGIN_PRINTF(("Plugin::ShutDownSubprocesses (%s)\n",
99 main_subprocess_.detailed_description().c_str())); 71 main_subprocess_.detailed_description().c_str()));
100 72
101 // Shut down service runtime. This must be done before all other calls so 73 // Shut down service runtime. This must be done before all other calls so
102 // they don't block forever when waiting for the upcall thread to exit. 74 // they don't block forever when waiting for the upcall thread to exit.
103 main_subprocess_.Shutdown(); 75 main_subprocess_.Shutdown();
104 76
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 PLUGIN_PRINTF(("Plugin::New (plugin=%p)\n", static_cast<void*>(plugin))); 360 PLUGIN_PRINTF(("Plugin::New (plugin=%p)\n", static_cast<void*>(plugin)));
389 return plugin; 361 return plugin;
390 } 362 }
391 363
392 // All failures of this function will show up as "Missing Plugin-in", so 364 // All failures of this function will show up as "Missing Plugin-in", so
393 // there is no need to log to JS console that there was an initialization 365 // there is no need to log to JS console that there was an initialization
394 // failure. Note that module loading functions will log their own errors. 366 // failure. Note that module loading functions will log their own errors.
395 bool Plugin::Init(uint32_t argc, const char* argn[], const char* argv[]) { 367 bool Plugin::Init(uint32_t argc, const char* argn[], const char* argv[]) {
396 PLUGIN_PRINTF(("Plugin::Init (argc=%" NACL_PRIu32 ")\n", argc)); 368 PLUGIN_PRINTF(("Plugin::Init (argc=%" NACL_PRIu32 ")\n", argc));
397 nacl_interface_->InitializePlugin(pp_instance(), argc, argn, argv); 369 nacl_interface_->InitializePlugin(pp_instance(), argc, argn, argv);
398
399 url_util_ = pp::URLUtil_Dev::Get(); 370 url_util_ = pp::URLUtil_Dev::Get();
400 if (url_util_ == NULL) 371 if (url_util_ == NULL)
401 return false; 372 return false;
402 373
403 PLUGIN_PRINTF(("Plugin::Init (url_util_=%p)\n", 374 wrapper_factory_ = new nacl::DescWrapperFactory();
404 static_cast<const void*>(url_util_))); 375 pp::Var manifest_url(pp::PASS_REF, nacl_interface_->GetManifestURLArgument(
405 376 pp_instance()));
406 bool status = EarlyInit(); 377 if (manifest_url.is_string() && !manifest_url.AsString().empty())
407 if (status) { 378 RequestNaClManifest(manifest_url.AsString());
408 pp::Var manifest_url(pp::PASS_REF, nacl_interface_->GetManifestURLArgument( 379 return true;
409 pp_instance()));
410 if (manifest_url.is_string() && !manifest_url.AsString().empty())
411 RequestNaClManifest(manifest_url.AsString());
412 }
413 PLUGIN_PRINTF(("Plugin::Init (status=%d)\n", status));
414 return status;
415 } 380 }
416 381
417 Plugin::Plugin(PP_Instance pp_instance) 382 Plugin::Plugin(PP_Instance pp_instance)
418 : pp::Instance(pp_instance), 383 : pp::Instance(pp_instance),
419 main_subprocess_("main subprocess", NULL, NULL), 384 main_subprocess_("main subprocess", NULL, NULL),
420 uses_nonsfi_mode_(false), 385 uses_nonsfi_mode_(false),
421 wrapper_factory_(NULL), 386 wrapper_factory_(NULL),
422 time_of_last_progress_event_(0), 387 time_of_last_progress_event_(0),
423 manifest_open_time_(-1), 388 manifest_open_time_(-1),
424 nexe_open_time_(-1), 389 nexe_open_time_(-1),
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 992
1028 void Plugin::SetExitStatusOnMainThread(int32_t pp_error, 993 void Plugin::SetExitStatusOnMainThread(int32_t pp_error,
1029 int exit_status) { 994 int exit_status) {
1030 DCHECK(pp::Module::Get()->core()->IsMainThread()); 995 DCHECK(pp::Module::Get()->core()->IsMainThread());
1031 DCHECK(nacl_interface_); 996 DCHECK(nacl_interface_);
1032 nacl_interface_->SetExitStatus(pp_instance(), exit_status); 997 nacl_interface_->SetExitStatus(pp_instance(), exit_status);
1033 } 998 }
1034 999
1035 1000
1036 } // namespace plugin 1001 } // namespace plugin
OLDNEW
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/plugin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698