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

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

Issue 10875077: Add UMA histogram to determine how often Stage3D could be used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: run on non-xp Created 8 years, 3 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/shared_impl/ppapi_preferences.cc ('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 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
(...skipping 11 matching lines...) Expand all
22 #include "ppapi/c/pp_rect.h" 22 #include "ppapi/c/pp_rect.h"
23 #include "ppapi/c/ppb_audio_config.h" 23 #include "ppapi/c/ppb_audio_config.h"
24 #include "ppapi/c/ppb_core.h" 24 #include "ppapi/c/ppb_core.h"
25 #include "ppapi/c/ppb_gamepad.h" 25 #include "ppapi/c/ppb_gamepad.h"
26 #include "ppapi/c/ppp_input_event.h" 26 #include "ppapi/c/ppp_input_event.h"
27 #include "ppapi/c/ppp_instance.h" 27 #include "ppapi/c/ppp_instance.h"
28 #include "ppapi/c/ppp_messaging.h" 28 #include "ppapi/c/ppp_messaging.h"
29 #include "ppapi/c/ppp_mouse_lock.h" 29 #include "ppapi/c/ppp_mouse_lock.h"
30 #include "ppapi/c/private/pp_content_decryptor.h" 30 #include "ppapi/c/private/pp_content_decryptor.h"
31 #include "ppapi/c/private/ppp_instance_private.h" 31 #include "ppapi/c/private/ppp_instance_private.h"
32 #include "ppapi/shared_impl/ppapi_preferences.h"
32 #include "ppapi/shared_impl/ppb_input_event_shared.h" 33 #include "ppapi/shared_impl/ppb_input_event_shared.h"
33 #include "ppapi/shared_impl/ppb_url_util_shared.h" 34 #include "ppapi/shared_impl/ppb_url_util_shared.h"
34 #include "ppapi/shared_impl/ppb_view_shared.h" 35 #include "ppapi/shared_impl/ppb_view_shared.h"
35 #include "ppapi/shared_impl/ppp_instance_combined.h" 36 #include "ppapi/shared_impl/ppp_instance_combined.h"
36 #include "ppapi/shared_impl/resource.h" 37 #include "ppapi/shared_impl/resource.h"
37 #include "ppapi/shared_impl/scoped_pp_resource.h" 38 #include "ppapi/shared_impl/scoped_pp_resource.h"
38 #include "ppapi/shared_impl/time_conversion.h" 39 #include "ppapi/shared_impl/time_conversion.h"
39 #include "ppapi/shared_impl/var.h" 40 #include "ppapi/shared_impl/var.h"
40 #include "ppapi/thunk/enter.h" 41 #include "ppapi/thunk/enter.h"
41 #include "ppapi/thunk/ppb_buffer_api.h" 42 #include "ppapi/thunk/ppb_buffer_api.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 #endif // defined(OS_MACOSX) 90 #endif // defined(OS_MACOSX)
90 91
91 #if defined(USE_SKIA) 92 #if defined(USE_SKIA)
92 #include "printing/metafile.h" 93 #include "printing/metafile.h"
93 #include "printing/metafile_skia_wrapper.h" 94 #include "printing/metafile_skia_wrapper.h"
94 #include "skia/ext/platform_device.h" 95 #include "skia/ext/platform_device.h"
95 #endif 96 #endif
96 97
97 #if defined(OS_WIN) 98 #if defined(OS_WIN)
98 #include "base/metrics/histogram.h" 99 #include "base/metrics/histogram.h"
100 #include "base/win/windows_version.h"
99 #include "skia/ext/platform_canvas.h" 101 #include "skia/ext/platform_canvas.h"
100 #include "ui/gfx/codec/jpeg_codec.h" 102 #include "ui/gfx/codec/jpeg_codec.h"
101 #include "ui/gfx/gdi_util.h" 103 #include "ui/gfx/gdi_util.h"
102 #endif 104 #endif
103 105
104 using base::StringPrintf; 106 using base::StringPrintf;
105 using ppapi::InputEventData; 107 using ppapi::InputEventData;
106 using ppapi::PpapiGlobals; 108 using ppapi::PpapiGlobals;
107 using ppapi::PPB_InputEvent_Shared; 109 using ppapi::PPB_InputEvent_Shared;
108 using ppapi::PPB_View_Shared; 110 using ppapi::PPB_View_Shared;
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 // Free any associated graphics. 528 // Free any associated graphics.
527 SetFullscreen(false); 529 SetFullscreen(false);
528 FlashSetFullscreen(false, false); 530 FlashSetFullscreen(false, false);
529 // Unbind current 2D or 3D graphics context. 531 // Unbind current 2D or 3D graphics context.
530 BindGraphics(pp_instance(), 0); 532 BindGraphics(pp_instance(), 0);
531 InvalidateRect(gfx::Rect()); 533 InvalidateRect(gfx::Rect());
532 534
533 delegate()->PluginCrashed(this); 535 delegate()->PluginCrashed(this);
534 } 536 }
535 537
538 static void SetGPUHistogram(const ::ppapi::Preferences& prefs,
539 const std::vector<std::string>& arg_names,
540 const std::vector<std::string>& arg_values) {
541 // Calculate a histogram to let us determine how likely people are to try to
542 // run Stage3D content on machines that have it blacklisted.
543 #if defined(OS_WIN)
544 bool needs_gpu = false;
545 bool is_xp = base::win::GetVersion() <= base::win::VERSION_XP;
546
547 for (size_t i = 0; i < arg_names.size(); i++) {
548 if (arg_names[i] == "wmode") {
549 // In theory content other than Flash could have a "wmode" argument,
550 // but that's pretty unlikely.
551 if (arg_values[i] == "direct" || arg_values[i] == "gpu")
552 needs_gpu = true;
553 break;
554 }
555 }
556 // 0 : No 3D content and GPU is blacklisted
557 // 1 : No 3D content and GPU is not blacklisted
558 // 2 : 3D content but GPU is blacklisted
559 // 3 : 3D content and GPU is not blacklisted
560 // 4 : No 3D content and GPU is blacklisted on XP
561 // 5 : No 3D content and GPU is not blacklisted on XP
562 // 6 : 3D content but GPU is blacklisted on XP
563 // 7 : 3D content and GPU is not blacklisted on XP
564 UMA_HISTOGRAM_ENUMERATION("Flash.UsesGPU",
565 is_xp * 4 + needs_gpu * 2 + prefs.is_webgl_supported, 8);
566 #endif
567 }
568
536 bool PluginInstance::Initialize(WebPluginContainer* container, 569 bool PluginInstance::Initialize(WebPluginContainer* container,
537 const std::vector<std::string>& arg_names, 570 const std::vector<std::string>& arg_names,
538 const std::vector<std::string>& arg_values, 571 const std::vector<std::string>& arg_values,
539 const GURL& plugin_url, 572 const GURL& plugin_url,
540 bool full_frame) { 573 bool full_frame) {
541 container_ = container; 574 container_ = container;
542 plugin_url_ = plugin_url; 575 plugin_url_ = plugin_url;
543 full_frame_ = full_frame; 576 full_frame_ = full_frame;
544 577
545 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents()); 578 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents());
546 579
580 SetGPUHistogram(delegate_->GetPreferences(), arg_names, arg_values);
581
547 argn_ = arg_names; 582 argn_ = arg_names;
548 argv_ = arg_values; 583 argv_ = arg_values;
549 scoped_array<const char*> argn_array(StringVectorToArgArray(argn_)); 584 scoped_array<const char*> argn_array(StringVectorToArgArray(argn_));
550 scoped_array<const char*> argv_array(StringVectorToArgArray(argv_)); 585 scoped_array<const char*> argv_array(StringVectorToArgArray(argv_));
551 return PP_ToBool(instance_interface_->DidCreate(pp_instance(), 586 return PP_ToBool(instance_interface_->DidCreate(pp_instance(),
552 argn_.size(), 587 argn_.size(),
553 argn_array.get(), 588 argn_array.get(),
554 argv_array.get())); 589 argv_array.get()));
555 } 590 }
556 591
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after
2433 screen_size_for_fullscreen_ = gfx::Size(); 2468 screen_size_for_fullscreen_ = gfx::Size();
2434 WebElement element = container_->element(); 2469 WebElement element = container_->element();
2435 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2470 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2436 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2471 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2437 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2472 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2438 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2473 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2439 } 2474 }
2440 2475
2441 } // namespace ppapi 2476 } // namespace ppapi
2442 } // namespace webkit 2477 } // namespace webkit
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppapi_preferences.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698