| 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/frame_host/render_widget_host_view_guest.h" | 5 #include "content/browser/frame_host/render_widget_host_view_guest.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 269 |
| 270 browser_plugin_guest_->set_attached(true); | 270 browser_plugin_guest_->set_attached(true); |
| 271 view_->OnSwapCompositorFrame( | 271 view_->OnSwapCompositorFrame( |
| 272 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); | 272 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); |
| 273 | 273 |
| 274 cc::SurfaceId id = GetSurfaceId(); | 274 cc::SurfaceId id = GetSurfaceId(); |
| 275 if (id.is_valid()) { | 275 if (id.is_valid()) { |
| 276 #if !defined(OS_ANDROID) | 276 #if !defined(OS_ANDROID) |
| 277 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 277 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 278 cc::SurfaceManager* manager = | 278 cc::SurfaceManager* manager = |
| 279 factory->GetContextFactory()->GetSurfaceManager(); | 279 factory->GetContextFactoryPrivate()->GetSurfaceManager(); |
| 280 cc::Surface* surface = manager->GetSurfaceForId(id); | 280 cc::Surface* surface = manager->GetSurfaceForId(id); |
| 281 EXPECT_TRUE(surface); | 281 EXPECT_TRUE(surface); |
| 282 // There should be a SurfaceSequence created by the RWHVGuest. | 282 // There should be a SurfaceSequence created by the RWHVGuest. |
| 283 EXPECT_EQ(1u, surface->GetDestructionDependencyCount()); | 283 EXPECT_EQ(1u, surface->GetDestructionDependencyCount()); |
| 284 #endif | 284 #endif |
| 285 // Surface ID should have been passed to BrowserPluginGuest to | 285 // Surface ID should have been passed to BrowserPluginGuest to |
| 286 // be sent to the embedding renderer. | 286 // be sent to the embedding renderer. |
| 287 EXPECT_EQ(id, browser_plugin_guest_->last_surface_id_received_); | 287 EXPECT_EQ(id, browser_plugin_guest_->last_surface_id_received_); |
| 288 EXPECT_EQ(view_size, browser_plugin_guest_->last_frame_size_received_); | 288 EXPECT_EQ(view_size, browser_plugin_guest_->last_frame_size_received_); |
| 289 EXPECT_EQ(scale_factor, browser_plugin_guest_->last_scale_factor_received_); | 289 EXPECT_EQ(scale_factor, browser_plugin_guest_->last_scale_factor_received_); |
| 290 } | 290 } |
| 291 | 291 |
| 292 browser_plugin_guest_->ResetTestData(); | 292 browser_plugin_guest_->ResetTestData(); |
| 293 browser_plugin_guest_->set_has_attached_since_surface_set(true); | 293 browser_plugin_guest_->set_has_attached_since_surface_set(true); |
| 294 | 294 |
| 295 view_->OnSwapCompositorFrame( | 295 view_->OnSwapCompositorFrame( |
| 296 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); | 296 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); |
| 297 | 297 |
| 298 id = GetSurfaceId(); | 298 id = GetSurfaceId(); |
| 299 if (id.is_valid()) { | 299 if (id.is_valid()) { |
| 300 #if !defined(OS_ANDROID) | 300 #if !defined(OS_ANDROID) |
| 301 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 301 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 302 cc::SurfaceManager* manager = | 302 cc::SurfaceManager* manager = |
| 303 factory->GetContextFactory()->GetSurfaceManager(); | 303 factory->GetContextFactoryPrivate()->GetSurfaceManager(); |
| 304 cc::Surface* surface = manager->GetSurfaceForId(id); | 304 cc::Surface* surface = manager->GetSurfaceForId(id); |
| 305 EXPECT_TRUE(surface); | 305 EXPECT_TRUE(surface); |
| 306 // There should be a SurfaceSequence created by the RWHVGuest. | 306 // There should be a SurfaceSequence created by the RWHVGuest. |
| 307 EXPECT_EQ(1u, surface->GetDestructionDependencyCount()); | 307 EXPECT_EQ(1u, surface->GetDestructionDependencyCount()); |
| 308 #endif | 308 #endif |
| 309 // Surface ID should have been passed to BrowserPluginGuest to | 309 // Surface ID should have been passed to BrowserPluginGuest to |
| 310 // be sent to the embedding renderer. | 310 // be sent to the embedding renderer. |
| 311 EXPECT_EQ(id, browser_plugin_guest_->last_surface_id_received_); | 311 EXPECT_EQ(id, browser_plugin_guest_->last_surface_id_received_); |
| 312 EXPECT_EQ(view_size, browser_plugin_guest_->last_frame_size_received_); | 312 EXPECT_EQ(view_size, browser_plugin_guest_->last_frame_size_received_); |
| 313 EXPECT_EQ(scale_factor, | 313 EXPECT_EQ(scale_factor, |
| 314 browser_plugin_guest_->last_scale_factor_received_); | 314 browser_plugin_guest_->last_scale_factor_received_); |
| 315 } | 315 } |
| 316 | 316 |
| 317 browser_plugin_guest_->set_attached(false); | 317 browser_plugin_guest_->set_attached(false); |
| 318 browser_plugin_guest_->ResetTestData(); | 318 browser_plugin_guest_->ResetTestData(); |
| 319 | 319 |
| 320 view_->OnSwapCompositorFrame( | 320 view_->OnSwapCompositorFrame( |
| 321 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); | 321 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); |
| 322 EXPECT_FALSE(GetSurfaceId().is_valid()); | 322 EXPECT_FALSE(GetSurfaceId().is_valid()); |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace content | 325 } // namespace content |
| OLD | NEW |