OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |