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

Side by Side Diff: components/bitmap_uploader/bitmap_uploader.cc

Issue 1942063002: Makes BitmapUploader early out if error encountered (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/bitmap_uploader/bitmap_uploader.h" 5 #include "components/bitmap_uploader/bitmap_uploader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 Format format) { 75 Format format) {
76 width_ = width; 76 width_ = width;
77 height_ = height; 77 height_ = height;
78 bitmap_ = std::move(data); 78 bitmap_ = std::move(data);
79 format_ = format; 79 format_ = format;
80 if (surface_) 80 if (surface_)
81 Upload(); 81 Upload();
82 } 82 }
83 83
84 void BitmapUploader::Upload() { 84 void BitmapUploader::Upload() {
85 // If the |gpu_service_| has errored than we won't get far. Do nothing,
86 // assuming we are in shutdown.
87 if (gpu_service_.encountered_error())
88 return;
89
85 const gfx::Rect bounds(window_->bounds()); 90 const gfx::Rect bounds(window_->bounds());
86 mus::mojom::PassPtr pass = mojo::CreateDefaultPass(1, bounds); 91 mus::mojom::PassPtr pass = mojo::CreateDefaultPass(1, bounds);
87 mus::mojom::CompositorFramePtr frame = mus::mojom::CompositorFrame::New(); 92 mus::mojom::CompositorFramePtr frame = mus::mojom::CompositorFrame::New();
88 93
89 // TODO(rjkroege): Support device scale factor in PDF viewer 94 // TODO(rjkroege): Support device scale factor in PDF viewer
90 mus::mojom::CompositorFrameMetadataPtr meta = 95 mus::mojom::CompositorFrameMetadataPtr meta =
91 mus::mojom::CompositorFrameMetadata::New(); 96 mus::mojom::CompositorFrameMetadata::New();
92 meta->device_scale_factor = 1.0f; 97 meta->device_scale_factor = 1.0f;
93 frame->metadata = std::move(meta); 98 frame->metadata = std::move(meta);
94 99
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 glWaitSyncTokenCHROMIUM( 247 glWaitSyncTokenCHROMIUM(
243 resource->sync_token.GetConstData()); 248 resource->sync_token.GetConstData());
244 uint32_t texture_id = resource_to_texture_id_map_[resource->id]; 249 uint32_t texture_id = resource_to_texture_id_map_[resource->id];
245 DCHECK_NE(0u, texture_id); 250 DCHECK_NE(0u, texture_id);
246 resource_to_texture_id_map_.erase(resource->id); 251 resource_to_texture_id_map_.erase(resource->id);
247 glDeleteTextures(1, &texture_id); 252 glDeleteTextures(1, &texture_id);
248 } 253 }
249 } 254 }
250 255
251 } // namespace bitmap_uploader 256 } // namespace bitmap_uploader
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