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

Side by Side Diff: content/browser/devtools/protocol/color_picker.cc

Issue 593503003: Support error handling for Surface readbacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted code and fixed build issue in test. Created 6 years, 1 month 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
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 "content/browser/devtools/protocol/color_picker.h" 5 #include "content/browser/devtools/protocol/color_picker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/browser/renderer_host/render_view_host_impl.h" 8 #include "content/browser/renderer_host/render_view_host_impl.h"
9 #include "content/browser/renderer_host/render_widget_host_view_base.h" 9 #include "content/browser/renderer_host/render_widget_host_view_base.h"
10 #include "content/common/cursors/webcursor.h" 10 #include "content/common/cursors/webcursor.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 weak_factory_.GetWeakPtr()), 88 weak_factory_.GetWeakPtr()),
89 kN32_SkColorType); 89 kN32_SkColorType);
90 } 90 }
91 91
92 void ColorPicker::ResetFrame() { 92 void ColorPicker::ResetFrame() {
93 frame_.reset(); 93 frame_.reset();
94 last_cursor_x_ = -1; 94 last_cursor_x_ = -1;
95 last_cursor_y_ = -1; 95 last_cursor_y_ = -1;
96 } 96 }
97 97
98 void ColorPicker::FrameUpdated(bool succeeded, const SkBitmap& bitmap) { 98 void ColorPicker::FrameUpdated(const SkBitmap& bitmap,
99 ReadbackResponse response) {
99 if (!enabled_) 100 if (!enabled_)
100 return; 101 return;
101 102
102 if (succeeded) { 103 if (response == READBACK_SUCCESS) {
103 frame_ = bitmap; 104 frame_ = bitmap;
104 UpdateCursor(); 105 UpdateCursor();
105 } 106 }
106 } 107 }
107 108
108 bool ColorPicker::HandleMouseEvent(const blink::WebMouseEvent& event) { 109 bool ColorPicker::HandleMouseEvent(const blink::WebMouseEvent& event) {
109 last_cursor_x_ = event.x; 110 last_cursor_x_ = event.x;
110 last_cursor_y_ = event.y; 111 last_cursor_y_ = event.y;
111 if (frame_.drawsNothing()) 112 if (frame_.drawsNothing())
112 return true; 113 return true;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 #endif 257 #endif
257 258
258 cursor.InitFromCursorInfo(cursor_info); 259 cursor.InitFromCursorInfo(cursor_info);
259 DCHECK(host_); 260 DCHECK(host_);
260 host_->SetCursor(cursor); 261 host_->SetCursor(cursor);
261 } 262 }
262 263
263 } // namespace page 264 } // namespace page
264 } // namespace devtools 265 } // namespace devtools
265 } // namespace content 266 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698