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

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

Issue 2862883002: WebVR: Don't crash when receiving null image from rendering context. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | 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 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } 552 }
553 } 553 }
554 554
555 RefPtr<Image> image_ref = rendering_context_->GetImage( 555 RefPtr<Image> image_ref = rendering_context_->GetImage(
556 kPreferAcceleration, kSnapshotReasonCreateImageBitmap); 556 kPreferAcceleration, kSnapshotReasonCreateImageBitmap);
557 557
558 // Hardware-accelerated rendering should always be texture backed, 558 // Hardware-accelerated rendering should always be texture backed,
559 // as implemented by AcceleratedStaticBitmapImage. Ensure this is 559 // as implemented by AcceleratedStaticBitmapImage. Ensure this is
560 // the case, don't attempt to render if using an unexpected drawing 560 // the case, don't attempt to render if using an unexpected drawing
561 // path. 561 // path.
562 if (!image_ref->IsTextureBacked()) { 562 if (!image_ref.Get() || !image_ref->IsTextureBacked()) {
563 NOTREACHED() << "WebVR requires hardware-accelerated rendering to texture"; 563 NOTREACHED() << "WebVR requires hardware-accelerated rendering to texture";
564 return; 564 return;
565 } 565 }
566 566
567 // The AcceleratedStaticBitmapImage must be kept alive until the 567 // The AcceleratedStaticBitmapImage must be kept alive until the
568 // mailbox is used via createAndConsumeTextureCHROMIUM, the mailbox 568 // mailbox is used via createAndConsumeTextureCHROMIUM, the mailbox
569 // itself does not keep it alive. We must keep a reference to the 569 // itself does not keep it alive. We must keep a reference to the
570 // image until the mailbox was consumed. 570 // image until the mailbox was consumed.
571 StaticBitmapImage* static_image = 571 StaticBitmapImage* static_image =
572 static_cast<StaticBitmapImage*>(image_ref.Get()); 572 static_cast<StaticBitmapImage*>(image_ref.Get());
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 visitor->Trace(stage_parameters_); 861 visitor->Trace(stage_parameters_);
862 visitor->Trace(eye_parameters_left_); 862 visitor->Trace(eye_parameters_left_);
863 visitor->Trace(eye_parameters_right_); 863 visitor->Trace(eye_parameters_right_);
864 visitor->Trace(layer_); 864 visitor->Trace(layer_);
865 visitor->Trace(rendering_context_); 865 visitor->Trace(rendering_context_);
866 visitor->Trace(scripted_animation_controller_); 866 visitor->Trace(scripted_animation_controller_);
867 visitor->Trace(pending_present_resolvers_); 867 visitor->Trace(pending_present_resolvers_);
868 } 868 }
869 869
870 } // namespace blink 870 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698