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

Side by Side Diff: athena/content/content_proxy.cc

Issue 611773002: Fixing issues with new activity image readback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | athena/content/web_activity.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "athena/content/content_proxy.h" 5 #include "athena/content/content_proxy.h"
6 6
7 #include "athena/activity/public/activity.h" 7 #include "athena/activity/public/activity.h"
8 #include "athena/activity/public/activity_view_model.h" 8 #include "athena/activity/public/activity_view_model.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/threading/worker_pool.h" 10 #include "base/threading/worker_pool.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // again. 75 // again.
76 ShowOriginalContent(); 76 ShowOriginalContent();
77 } 77 }
78 78
79 void ContentProxy::ContentWillUnload() { 79 void ContentProxy::ContentWillUnload() {
80 content_loaded_ = false; 80 content_loaded_ = false;
81 } 81 }
82 82
83 gfx::ImageSkia ContentProxy::GetContentImage() { 83 gfx::ImageSkia ContentProxy::GetContentImage() {
84 // While we compress to PNG, we use the original read back. 84 // While we compress to PNG, we use the original read back.
85 if (!raw_image_.isNull() || !png_data_.get()) 85 if (!png_data_.get())
86 return raw_image_; 86 return raw_image_;
87 87
88 // Otherwise we convert the PNG. 88 // Otherwise we convert the PNG.
89 std::vector<gfx::ImagePNGRep> image_reps; 89 std::vector<gfx::ImagePNGRep> image_reps;
90 image_reps.push_back(gfx::ImagePNGRep(png_data_, 0.0f)); 90 image_reps.push_back(gfx::ImagePNGRep(png_data_, 1.0f));
91 return *(gfx::Image(image_reps).ToImageSkia()); 91 return *(gfx::Image(image_reps).ToImageSkia());
92 } 92 }
93 93
94 void ContentProxy::EvictContent() { 94 void ContentProxy::EvictContent() {
95 raw_image_ = gfx::ImageSkia(); 95 raw_image_ = gfx::ImageSkia();
96 png_data_->Release(); 96 png_data_->Release();
97 } 97 }
98 98
99 void ContentProxy::OnPreContentDestroyed() { 99 void ContentProxy::OnPreContentDestroyed() {
100 // Since we are breaking now the connection to the old content, we make the 100 // Since we are breaking now the connection to the old content, we make the
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 void ContentProxy::OnContentImageEncodeComplete( 181 void ContentProxy::OnContentImageEncodeComplete(
182 scoped_refptr<ProxyImageData> image) { 182 scoped_refptr<ProxyImageData> image) {
183 png_data_ = image->data(); 183 png_data_ = image->data();
184 184
185 // From now on we decode the image as needed to save memory. 185 // From now on we decode the image as needed to save memory.
186 raw_image_ = gfx::ImageSkia(); 186 raw_image_ = gfx::ImageSkia();
187 } 187 }
188 188
189 } // namespace athena 189 } // namespace athena
OLDNEW
« no previous file with comments | « no previous file | athena/content/web_activity.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698