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

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

Issue 8951014: Change the DidChangeView update to take a new ViewChanged resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: New patch Created 9 years 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "native_client/src/trusted/plugin/plugin.h" 10 #include "native_client/src/trusted/plugin/plugin.h"
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 argc_(-1), 985 argc_(-1),
986 argn_(NULL), 986 argn_(NULL),
987 argv_(NULL), 987 argv_(NULL),
988 main_subprocess_(kMainSubprocessId, NULL, NULL), 988 main_subprocess_(kMainSubprocessId, NULL, NULL),
989 nacl_ready_state_(UNSENT), 989 nacl_ready_state_(UNSENT),
990 nexe_error_reported_(false), 990 nexe_error_reported_(false),
991 wrapper_factory_(NULL), 991 wrapper_factory_(NULL),
992 last_error_string_(""), 992 last_error_string_(""),
993 ppapi_proxy_(NULL), 993 ppapi_proxy_(NULL),
994 enable_dev_interfaces_(false), 994 enable_dev_interfaces_(false),
995 replayDidChangeView(false),
996 replayHandleDocumentLoad(false),
997 init_time_(0), 995 init_time_(0),
998 ready_time_(0), 996 ready_time_(0),
999 nexe_size_(0), 997 nexe_size_(0),
1000 time_of_last_progress_event_(0) { 998 time_of_last_progress_event_(0) {
1001 PLUGIN_PRINTF(("Plugin::Plugin (this=%p, pp_instance=%" 999 PLUGIN_PRINTF(("Plugin::Plugin (this=%p, pp_instance=%"
1002 NACL_PRId32")\n", static_cast<void*>(this), pp_instance)); 1000 NACL_PRId32")\n", static_cast<void*>(this), pp_instance));
1003 callback_factory_.Initialize(this); 1001 callback_factory_.Initialize(this);
1004 nexe_downloader_.Initialize(this); 1002 nexe_downloader_.Initialize(this);
1005 } 1003 }
1006 1004
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 HistogramTimeSmall( 1062 HistogramTimeSmall(
1065 "NaCl.Perf.ShutdownTime.Total", 1063 "NaCl.Perf.ShutdownTime.Total",
1066 (NaClGetTimeOfDayMicroseconds() - shutdown_start) 1064 (NaClGetTimeOfDayMicroseconds() - shutdown_start)
1067 / NACL_MICROS_PER_MILLI); 1065 / NACL_MICROS_PER_MILLI);
1068 1066
1069 PLUGIN_PRINTF(("Plugin::~Plugin (this=%p, return)\n", 1067 PLUGIN_PRINTF(("Plugin::~Plugin (this=%p, return)\n",
1070 static_cast<void*>(this))); 1068 static_cast<void*>(this)));
1071 } 1069 }
1072 1070
1073 1071
1074 void Plugin::DidChangeView(const pp::Rect& position, const pp::Rect& clip) { 1072 void Plugin::DidChangeView(const pp::View& view) {
1075 PLUGIN_PRINTF(("Plugin::DidChangeView (this=%p)\n", 1073 PLUGIN_PRINTF(("Plugin::DidChangeView (this=%p)\n",
1076 static_cast<void*>(this))); 1074 static_cast<void*>(this)));
1077 1075
1078 if (!BrowserPpp::is_valid(ppapi_proxy_)) { 1076 if (!BrowserPpp::is_valid(ppapi_proxy_)) {
1079 // Store this event and replay it when the proxy becomes available. 1077 // Store this event and replay it when the proxy becomes available.
1080 replayDidChangeView = true; 1078 view_to_replay_ = view;
1081 replayDidChangeViewPosition = position;
1082 replayDidChangeViewClip = clip;
1083 return;
1084 } else { 1079 } else {
1085 ppapi_proxy_->ppp_instance_interface()->DidChangeView( 1080 ppapi_proxy_->ppp_instance_interface()->DidChangeView(
1086 pp_instance(), &(position.pp_rect()), &(clip.pp_rect())); 1081 pp_instance(), view.pp_resource());
dmichael (off chromium) 2011/12/20 19:01:34 Wait, I thought you needed to pass the resource as
brettw 2011/12/21 23:55:29 This is on the browser side. Everything about NaCl
1087 } 1082 }
1088 } 1083 }
1089 1084
1090 1085
1091 void Plugin::DidChangeFocus(bool has_focus) { 1086 void Plugin::DidChangeFocus(bool has_focus) {
1092 PLUGIN_PRINTF(("Plugin::DidChangeFocus (this=%p)\n", 1087 PLUGIN_PRINTF(("Plugin::DidChangeFocus (this=%p)\n",
1093 static_cast<void*>(this))); 1088 static_cast<void*>(this)));
1094 if (!BrowserPpp::is_valid(ppapi_proxy_)) { 1089 if (BrowserPpp::is_valid(ppapi_proxy_)) {
1095 return;
1096 } else {
1097 ppapi_proxy_->ppp_instance_interface()->DidChangeFocus( 1090 ppapi_proxy_->ppp_instance_interface()->DidChangeFocus(
1098 pp_instance(), PP_FromBool(has_focus)); 1091 pp_instance(), PP_FromBool(has_focus));
1099 } 1092 }
1100 } 1093 }
1101 1094
1102 1095
1103 bool Plugin::HandleInputEvent(const pp::InputEvent& event) { 1096 bool Plugin::HandleInputEvent(const pp::InputEvent& event) {
1104 PLUGIN_PRINTF(("Plugin::HandleInputEvent (this=%p)\n", 1097 PLUGIN_PRINTF(("Plugin::HandleInputEvent (this=%p)\n",
1105 static_cast<void*>(this))); 1098 static_cast<void*>(this)));
1106 if (!BrowserPpp::is_valid(ppapi_proxy_) || 1099 if (!BrowserPpp::is_valid(ppapi_proxy_) ||
1107 ppapi_proxy_->ppp_input_event_interface() == NULL) { 1100 ppapi_proxy_->ppp_input_event_interface() == NULL) {
1108 return false; // event is not handled here. 1101 return false; // event is not handled here.
1109 } else { 1102 } else {
1110 bool handled = PP_ToBool( 1103 bool handled = PP_ToBool(
1111 ppapi_proxy_->ppp_input_event_interface()->HandleInputEvent( 1104 ppapi_proxy_->ppp_input_event_interface()->HandleInputEvent(
1112 pp_instance(), event.pp_resource())); 1105 pp_instance(), event.pp_resource()));
1113 PLUGIN_PRINTF(("Plugin::HandleInputEvent (handled=%d)\n", handled)); 1106 PLUGIN_PRINTF(("Plugin::HandleInputEvent (handled=%d)\n", handled));
1114 return handled; 1107 return handled;
1115 } 1108 }
1116 } 1109 }
1117 1110
1118 1111
1119 bool Plugin::HandleDocumentLoad(const pp::URLLoader& url_loader) { 1112 bool Plugin::HandleDocumentLoad(const pp::URLLoader& url_loader) {
1120 PLUGIN_PRINTF(("Plugin::HandleDocumentLoad (this=%p)\n", 1113 PLUGIN_PRINTF(("Plugin::HandleDocumentLoad (this=%p)\n",
1121 static_cast<void*>(this))); 1114 static_cast<void*>(this)));
1122 if (!BrowserPpp::is_valid(ppapi_proxy_)) { 1115 if (!BrowserPpp::is_valid(ppapi_proxy_)) {
1123 // Store this event and replay it when the proxy becomes available. 1116 // Store this event and replay it when the proxy becomes available.
1124 replayHandleDocumentLoad = true; 1117 document_load_to_replay_ = url_loader;
1125 replayHandleDocumentLoadURLLoader = url_loader;
1126 // Return true so that the browser keeps servicing this loader so we can 1118 // Return true so that the browser keeps servicing this loader so we can
1127 // perform requests on it later. 1119 // perform requests on it later.
1128 return true; 1120 return true;
1129 } else { 1121 } else {
1130 return PP_ToBool( 1122 return PP_ToBool(
1131 ppapi_proxy_->ppp_instance_interface()->HandleDocumentLoad( 1123 ppapi_proxy_->ppp_instance_interface()->HandleDocumentLoad(
1132 pp_instance(), url_loader.pp_resource())); 1124 pp_instance(), url_loader.pp_resource()));
1133 } 1125 }
1134 } 1126 }
1135 1127
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 1397
1406 // Create PPP* interface adapters to forward calls to .nexe. 1398 // Create PPP* interface adapters to forward calls to .nexe.
1407 find_adapter_.reset(new(std::nothrow) FindAdapter(this)); 1399 find_adapter_.reset(new(std::nothrow) FindAdapter(this));
1408 mouse_lock_adapter_.reset(new(std::nothrow) MouseLockAdapter(this)); 1400 mouse_lock_adapter_.reset(new(std::nothrow) MouseLockAdapter(this));
1409 printing_adapter_.reset(new(std::nothrow) PrintingAdapter(this)); 1401 printing_adapter_.reset(new(std::nothrow) PrintingAdapter(this));
1410 selection_adapter_.reset(new(std::nothrow) SelectionAdapter(this)); 1402 selection_adapter_.reset(new(std::nothrow) SelectionAdapter(this));
1411 widget_client_adapter_.reset(new(std::nothrow) WidgetClientAdapter(this)); 1403 widget_client_adapter_.reset(new(std::nothrow) WidgetClientAdapter(this));
1412 zoom_adapter_.reset(new(std::nothrow) ZoomAdapter(this)); 1404 zoom_adapter_.reset(new(std::nothrow) ZoomAdapter(this));
1413 1405
1414 // Replay missed events. 1406 // Replay missed events.
1415 if (replayDidChangeView) { 1407 if (!view_to_replay_.is_null()) {
1416 replayDidChangeView = false; 1408 DidChangeView(view_to_replay_);
1417 DidChangeView(replayDidChangeViewPosition, replayDidChangeViewClip); 1409 view_to_replay_ = pp::View();
1418 } 1410 }
1419 if (replayHandleDocumentLoad) { 1411 if (!document_load_to_replay_.is_null()) {
1420 replayHandleDocumentLoad = false; 1412 HandleDocumentLoad(document_load_to_replay_);
1421 HandleDocumentLoad(replayHandleDocumentLoadURLLoader); 1413 document_load_to_replay_ = pp::URLLoader();
1422 // Release our reference on this loader.
1423 replayHandleDocumentLoadURLLoader = pp::URLLoader();
1424 } 1414 }
1425 bool is_valid_proxy = BrowserPpp::is_valid(ppapi_proxy_); 1415 bool is_valid_proxy = BrowserPpp::is_valid(ppapi_proxy_);
1426 PLUGIN_PRINTF(("Plugin::StartProxiedExecution (is_valid_proxy=%d)\n", 1416 PLUGIN_PRINTF(("Plugin::StartProxiedExecution (is_valid_proxy=%d)\n",
1427 is_valid_proxy)); 1417 is_valid_proxy));
1428 if (!is_valid_proxy) { 1418 if (!is_valid_proxy) {
1429 error_info->SetReport(ERROR_START_PROXY_CRASH, 1419 error_info->SetReport(ERROR_START_PROXY_CRASH,
1430 "instance crashed after creation."); 1420 "instance crashed after creation.");
1431 } 1421 }
1432 return is_valid_proxy; 1422 return is_valid_proxy;
1433 } 1423 }
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 std::string scheme = canonicalized.AsString().substr(comps.scheme.begin, 2034 std::string scheme = canonicalized.AsString().substr(comps.scheme.begin,
2045 comps.scheme.len); 2035 comps.scheme.len);
2046 if (scheme == kChromeExtensionUriScheme) 2036 if (scheme == kChromeExtensionUriScheme)
2047 return SCHEME_CHROME_EXTENSION; 2037 return SCHEME_CHROME_EXTENSION;
2048 if (scheme == kDataUriScheme) 2038 if (scheme == kDataUriScheme)
2049 return SCHEME_DATA; 2039 return SCHEME_DATA;
2050 return SCHEME_OTHER; 2040 return SCHEME_OTHER;
2051 } 2041 }
2052 2042
2053 } // namespace plugin 2043 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698