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

Side by Side Diff: third_party/WebKit/Source/modules/vr/VRDisplay.cpp

Issue 2867093005: Add UMA metrics to track user action sequence in VR (Closed)
Patch Set: uncomment assert Created 3 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "modules/vr/VRDisplay.h" 5 #include "modules/vr/VRDisplay.h"
6 6
7 #include "core/css/StylePropertySet.h" 7 #include "core/css/StylePropertySet.h"
8 #include "core/dom/DOMException.h" 8 #include "core/dom/DOMException.h"
9 #include "core/dom/FrameRequestCallback.h" 9 #include "core/dom/FrameRequestCallback.h"
10 #include "core/dom/ScriptedAnimationController.h" 10 #include "core/dom/ScriptedAnimationController.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // updated. 213 // updated.
214 if (first_present && !UserGestureIndicator::ProcessingUserGesture() && 214 if (first_present && !UserGestureIndicator::ProcessingUserGesture() &&
215 !in_display_activate_) { 215 !in_display_activate_) {
216 DOMException* exception = DOMException::Create( 216 DOMException* exception = DOMException::Create(
217 kInvalidStateError, "API can only be initiated by a user gesture."); 217 kInvalidStateError, "API can only be initiated by a user gesture.");
218 resolver->Reject(exception); 218 resolver->Reject(exception);
219 ReportPresentationResult(PresentationResult::kNotInitiatedByUserGesture); 219 ReportPresentationResult(PresentationResult::kNotInitiatedByUserGesture);
220 return promise; 220 return promise;
221 } 221 }
222 222
223 // When we are requesting to start presentation with a user action or the
224 // display has activated, record the user action.
225 if (first_present &&
mthiesse 2017/05/10 14:58:13 Why duplicate the logic for when we should (usuall
billorr 2017/05/10 18:47:13 I'm trying to filter calls of "requestPresent" to
226 (UserGestureIndicator::ProcessingUserGesture() || in_display_activate_)) {
227 Platform::Current()->RecordAction(
228 UserMetricsAction("VR.WebVR.requestPresent"));
229 }
230
223 // A valid number of layers must be provided in order to present. 231 // A valid number of layers must be provided in order to present.
224 if (layers.size() == 0 || layers.size() > capabilities_->maxLayers()) { 232 if (layers.size() == 0 || layers.size() > capabilities_->maxLayers()) {
225 ForceExitPresent(); 233 ForceExitPresent();
226 DOMException* exception = 234 DOMException* exception =
227 DOMException::Create(kInvalidStateError, "Invalid number of layers."); 235 DOMException::Create(kInvalidStateError, "Invalid number of layers.");
228 resolver->Reject(exception); 236 resolver->Reject(exception);
229 ReportPresentationResult(PresentationResult::kInvalidNumberOfLayers); 237 ReportPresentationResult(PresentationResult::kInvalidNumberOfLayers);
230 return promise; 238 return promise;
231 } 239 }
232 240
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 if (layer_.source().isHTMLCanvasElement()) { 672 if (layer_.source().isHTMLCanvasElement()) {
665 // TODO(klausw,crbug.com/698923): If compositor updates are 673 // TODO(klausw,crbug.com/698923): If compositor updates are
666 // suppressed, restore them here. 674 // suppressed, restore them here.
667 } else { 675 } else {
668 // TODO(junov, crbug.com/695497): Implement for OffscreenCanvas 676 // TODO(junov, crbug.com/695497): Implement for OffscreenCanvas
669 } 677 }
670 } else { 678 } else {
671 // Can't get into this presentation mode, so nothing to do here. 679 // Can't get into this presentation mode, so nothing to do here.
672 } 680 }
673 is_presenting_ = false; 681 is_presenting_ = false;
682
674 OnPresentChange(); 683 OnPresentChange();
684
685 // Record user action for stop presenting. Note that this could be
686 // user-triggered or not.
687 Platform::Current()->RecordAction(
688 UserMetricsAction("VR.WebVR.StopPresenting"));
675 } 689 }
676 690
677 rendering_context_ = nullptr; 691 rendering_context_ = nullptr;
678 context_gl_ = nullptr; 692 context_gl_ = nullptr;
679 pending_submit_frame_ = false; 693 pending_submit_frame_ = false;
680 pending_previous_frame_render_ = false; 694 pending_previous_frame_render_ = false;
681 } 695 }
682 696
683 void VRDisplay::OnActivate(device::mojom::blink::VRDisplayEventReason reason, 697 void VRDisplay::OnActivate(device::mojom::blink::VRDisplayEventReason reason,
684 const OnActivateCallback& on_handled) { 698 const OnActivateCallback& on_handled) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 visitor->Trace(stage_parameters_); 881 visitor->Trace(stage_parameters_);
868 visitor->Trace(eye_parameters_left_); 882 visitor->Trace(eye_parameters_left_);
869 visitor->Trace(eye_parameters_right_); 883 visitor->Trace(eye_parameters_right_);
870 visitor->Trace(layer_); 884 visitor->Trace(layer_);
871 visitor->Trace(rendering_context_); 885 visitor->Trace(rendering_context_);
872 visitor->Trace(scripted_animation_controller_); 886 visitor->Trace(scripted_animation_controller_);
873 visitor->Trace(pending_present_resolvers_); 887 visitor->Trace(pending_present_resolvers_);
874 } 888 }
875 889
876 } // namespace blink 890 } // namespace blink
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java ('k') | tools/metrics/actions/actions.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698