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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 7629017: Add a unified resource tracker shared between the proxy and the impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 9 years, 4 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
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 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 if (!event_class) 447 if (!event_class)
448 return false; 448 return false;
449 449
450 if ((filtered_input_event_mask_ & event_class) || 450 if ((filtered_input_event_mask_ & event_class) ||
451 (input_event_mask_ & event_class)) { 451 (input_event_mask_ & event_class)) {
452 // Actually send the event. 452 // Actually send the event.
453 std::vector< ::ppapi::InputEventData > events; 453 std::vector< ::ppapi::InputEventData > events;
454 CreateInputEventData(event, &events); 454 CreateInputEventData(event, &events);
455 455
456 // Each input event may generate more than one PP_InputEvent. 456 // Each input event may generate more than one PP_InputEvent.
457 ResourceTracker* tracker = ResourceTracker::Get();
458 for (size_t i = 0; i < events.size(); i++) { 457 for (size_t i = 0; i < events.size(); i++) {
459 if (filtered_input_event_mask_ & event_class) 458 if (filtered_input_event_mask_ & event_class)
460 events[i].is_filtered = true; 459 events[i].is_filtered = true;
461 else 460 else
462 rv = true; // Unfiltered events are assumed to be handled. 461 rv = true; // Unfiltered events are assumed to be handled.
463 scoped_refptr<PPB_InputEvent_Impl> event_resource( 462 scoped_refptr<PPB_InputEvent_Impl> event_resource(
464 new PPB_InputEvent_Impl(this, events[i])); 463 new PPB_InputEvent_Impl(this, events[i]));
465 PP_Resource resource = event_resource->GetReference(); 464 Resource::ScopedResourceId resource_id(event_resource.get());
466 465
467 rv |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent( 466 rv |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent(
468 pp_instance(), event_resource->GetReference())); 467 pp_instance(), resource_id.id));
469
470 // Release the reference we took above.
471 tracker->UnrefResource(resource);
472 } 468 }
473 } 469 }
474 } 470 }
475 471
476 if (cursor_.get()) 472 if (cursor_.get())
477 *cursor_info = *cursor_; 473 *cursor_info = *cursor_;
478 return rv; 474 return rv;
479 } 475 }
480 476
481 void PluginInstance::HandlePolicyUpdate(const std::string& policy_json) { 477 void PluginInstance::HandlePolicyUpdate(const std::string& policy_json) {
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 } 1542 }
1547 1543
1548 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) { 1544 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) {
1549 cursor_.reset(cursor); 1545 cursor_.reset(cursor);
1550 if (fullscreen_container_) 1546 if (fullscreen_container_)
1551 fullscreen_container_->DidChangeCursor(*cursor); 1547 fullscreen_container_->DidChangeCursor(*cursor);
1552 } 1548 }
1553 1549
1554 } // namespace ppapi 1550 } // namespace ppapi
1555 } // namespace webkit 1551 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698