| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/compositor/browser_compositor_view_private_mac.h" | 5 #include "content/browser/compositor/browser_compositor_view_private_mac.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/message_loop/message_loop.h" |
| 8 #include "content/browser/compositor/gpu_process_transport_factory.h" | 9 #include "content/browser/compositor/gpu_process_transport_factory.h" |
| 9 #include "content/browser/renderer_host/compositing_iosurface_context_mac.h" | 10 #include "content/browser/renderer_host/compositing_iosurface_context_mac.h" |
| 10 #include "content/browser/renderer_host/compositing_iosurface_mac.h" | 11 #include "content/browser/renderer_host/compositing_iosurface_mac.h" |
| 11 #include "content/browser/renderer_host/software_layer_mac.h" | 12 #include "content/browser/renderer_host/software_layer_mac.h" |
| 12 #include "content/public/browser/context_factory.h" | 13 #include "content/public/browser/context_factory.h" |
| 13 #include "ui/base/cocoa/animation_utils.h" | 14 #include "ui/base/cocoa/animation_utils.h" |
| 14 #include "ui/gl/scoped_cgl.h" | 15 #include "ui/gl/scoped_cgl.h" |
| 15 | 16 |
| 16 //////////////////////////////////////////////////////////////////////////////// | 17 //////////////////////////////////////////////////////////////////////////////// |
| 17 // BrowserCompositorViewMacInternal | 18 // BrowserCompositorViewMacInternal |
| (...skipping 14 matching lines...) Expand all Loading... |
| 32 [flipped_layer_ setAnchorPoint:CGPointMake(0, 0)]; | 33 [flipped_layer_ setAnchorPoint:CGPointMake(0, 0)]; |
| 33 [flipped_layer_ | 34 [flipped_layer_ |
| 34 setAutoresizingMask:kCALayerWidthSizable|kCALayerHeightSizable]; | 35 setAutoresizingMask:kCALayerWidthSizable|kCALayerHeightSizable]; |
| 35 | 36 |
| 36 // Set the Cocoa view to be hosting the un-flipped background layer (hosting | 37 // Set the Cocoa view to be hosting the un-flipped background layer (hosting |
| 37 // a flipped layer results in unpredictable behavior). | 38 // a flipped layer results in unpredictable behavior). |
| 38 cocoa_view_.reset([[BrowserCompositorViewCocoa alloc] initWithClient:this]); | 39 cocoa_view_.reset([[BrowserCompositorViewCocoa alloc] initWithClient:this]); |
| 39 | 40 |
| 40 // Create a compositor to draw the contents of |cocoa_view_|. | 41 // Create a compositor to draw the contents of |cocoa_view_|. |
| 41 compositor_.reset(new ui::Compositor( | 42 compositor_.reset(new ui::Compositor( |
| 42 cocoa_view_, content::GetContextFactory())); | 43 cocoa_view_, |
| 44 content::GetContextFactory(), |
| 45 base::MessageLoopProxy::current())); |
| 43 } | 46 } |
| 44 | 47 |
| 45 BrowserCompositorViewMacInternal::~BrowserCompositorViewMacInternal() { | 48 BrowserCompositorViewMacInternal::~BrowserCompositorViewMacInternal() { |
| 46 DCHECK(!client_); | 49 DCHECK(!client_); |
| 47 [cocoa_view_ resetClient]; | 50 [cocoa_view_ resetClient]; |
| 48 } | 51 } |
| 49 | 52 |
| 50 void BrowserCompositorViewMacInternal::SetClient( | 53 void BrowserCompositorViewMacInternal::SetClient( |
| 51 BrowserCompositorViewMacClient* client) { | 54 BrowserCompositorViewMacClient* client) { |
| 52 // Disable the fade-in animation as the view is added. | 55 // Disable the fade-in animation as the view is added. |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data | 263 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data |
| 261 withScaleFactor:(float)scale_factor | 264 withScaleFactor:(float)scale_factor |
| 262 withCanvas:(SkCanvas*)canvas { | 265 withCanvas:(SkCanvas*)canvas { |
| 263 if (!client_) | 266 if (!client_) |
| 264 return; | 267 return; |
| 265 client_->GotSoftwareFrame(frame_data, scale_factor, canvas); | 268 client_->GotSoftwareFrame(frame_data, scale_factor, canvas); |
| 266 } | 269 } |
| 267 | 270 |
| 268 @end // BrowserCompositorViewCocoa | 271 @end // BrowserCompositorViewCocoa |
| 269 | 272 |
| OLD | NEW |