Update from https://crrev.com/319330
- New chromium clang rules require explicit external destructors so
system/lib added for MessagePipe, DataPipe and SharedBuffer
- New chromium clang rules require override and no virtual in
declarations, so many files updated.
- cc_strip_video patch updated.
BUG=
R=jamesr@chromium.org
Review URL: https://codereview.chromium.org/988693005
diff --git a/ui/android/java/src/org/chromium/ui/base/Clipboard.java b/ui/android/java/src/org/chromium/ui/base/Clipboard.java
index aaa500e..67aaca2 100644
--- a/ui/android/java/src/org/chromium/ui/base/Clipboard.java
+++ b/ui/android/java/src/org/chromium/ui/base/Clipboard.java
@@ -4,12 +4,13 @@
package org.chromium.ui.base;
+import android.annotation.TargetApi;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
+import android.os.Build;
import android.widget.Toast;
-import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.ui.R;
@@ -20,6 +21,10 @@
*/
@JNINamespace("ui")
public class Clipboard {
+
+ private static final boolean IS_HTML_CLIPBOARD_SUPPORTED =
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
+
// Necessary for coercing clipboard contents to text if they require
// access to network resources, etceteras (e.g., URI in clipboard)
private final Context mContext;
@@ -83,9 +88,10 @@
* @return a Java string with the html text if any, or null if there is no html
* text or no entries on the primary clip.
*/
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@CalledByNative
private String getHTMLText() {
- if (isHTMLClipboardSupported()) {
+ if (IS_HTML_CLIPBOARD_SUPPORTED) {
final ClipData clip = mClipboardManager.getPrimaryClip();
if (clip != null && clip.getItemCount() > 0) {
return clip.getItemAt(0).getHtmlText();
@@ -129,8 +135,9 @@
* @param label The Plain-text label for the HTML content.
* @param text Plain-text representation of the HTML content.
*/
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void setHTMLText(final String html, final String label, final String text) {
- if (isHTMLClipboardSupported()) {
+ if (IS_HTML_CLIPBOARD_SUPPORTED) {
setPrimaryClipNoException(ClipData.newHtmlText(label, text, html));
}
}
@@ -150,7 +157,7 @@
@CalledByNative
private static boolean isHTMLClipboardSupported() {
- return ApiCompatibilityUtils.isHTMLClipboardSupported();
+ return IS_HTML_CLIPBOARD_SUPPORTED;
}
private void setPrimaryClipNoException(ClipData clip) {
diff --git a/ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java b/ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java
index 5f4c598..e785af6 100644
--- a/ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java
+++ b/ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java
@@ -60,12 +60,6 @@
}
@CalledByNative
- private static void setDefaultBufferSize(SurfaceTexture surfaceTexture, int width,
- int height) {
- surfaceTexture.setDefaultBufferSize(width, height);
- }
-
- @CalledByNative
private static void getTransformMatrix(SurfaceTexture surfaceTexture, float[] matrix) {
surfaceTexture.getTransformMatrix(matrix);
}
diff --git a/ui/events/event_dispatcher_unittest.cc b/ui/events/event_dispatcher_unittest.cc
index ad00122..d6caf00 100644
--- a/ui/events/event_dispatcher_unittest.cc
+++ b/ui/events/event_dispatcher_unittest.cc
@@ -18,7 +18,7 @@
class TestTarget : public EventTarget {
public:
TestTarget() : parent_(NULL), valid_(true) {}
- virtual ~TestTarget() {}
+ ~TestTarget() override {}
void set_parent(TestTarget* parent) { parent_ = parent; }
@@ -38,19 +38,19 @@
private:
// Overridden from EventTarget:
- virtual bool CanAcceptEvent(const ui::Event& event) override {
+ bool CanAcceptEvent(const ui::Event& event) override {
return true;
}
- virtual EventTarget* GetParentTarget() override {
+ EventTarget* GetParentTarget() override {
return parent_;
}
- virtual scoped_ptr<EventTargetIterator> GetChildIterator() override {
+ scoped_ptr<EventTargetIterator> GetChildIterator() override {
return scoped_ptr<EventTargetIterator>();
}
- virtual EventTargeter* GetEventTargeter() override {
+ EventTargeter* GetEventTargeter() override {
return NULL;
}
@@ -71,7 +71,7 @@
received_pre_target_(false) {
}
- virtual ~TestEventHandler() {}
+ ~TestEventHandler() override {}
virtual void ReceivedEvent(Event* event) {
static_cast<TestTarget*>(event->target())->AddHandlerId(id_);
@@ -94,7 +94,7 @@
private:
// Overridden from EventHandler:
- virtual void OnEvent(Event* event) override {
+ void OnEvent(Event* event) override {
ui::EventHandler::OnEvent(event);
ReceivedEvent(event);
SetStatusOnEvent(event);
@@ -123,7 +123,7 @@
set_cancelable(false);
}
- virtual ~NonCancelableEvent() {}
+ ~NonCancelableEvent() override {}
private:
DISALLOW_COPY_AND_ASSIGN(NonCancelableEvent);
@@ -138,10 +138,10 @@
dispatcher_delegate_(delegate) {
}
- virtual ~EventHandlerDestroyDispatcherDelegate() {}
+ ~EventHandlerDestroyDispatcherDelegate() override {}
private:
- virtual void ReceivedEvent(Event* event) override {
+ void ReceivedEvent(Event* event) override {
TestEventHandler::ReceivedEvent(event);
delete dispatcher_delegate_;
}
@@ -155,10 +155,10 @@
class InvalidateTargetEventHandler : public TestEventHandler {
public:
explicit InvalidateTargetEventHandler(int id) : TestEventHandler(id) {}
- virtual ~InvalidateTargetEventHandler() {}
+ ~InvalidateTargetEventHandler() override {}
private:
- virtual void ReceivedEvent(Event* event) override {
+ void ReceivedEvent(Event* event) override {
TestEventHandler::ReceivedEvent(event);
TestTarget* target = static_cast<TestTarget*>(event->target());
target->set_valid(false);
@@ -177,7 +177,7 @@
dispatcher_delegate_(NULL) {
}
- virtual ~EventHandlerDestroyer() {
+ ~EventHandlerDestroyer() override {
CHECK(!to_destroy_);
}
@@ -186,7 +186,7 @@
}
private:
- virtual void ReceivedEvent(Event* event) override {
+ void ReceivedEvent(Event* event) override {
TestEventHandler::ReceivedEvent(event);
delete to_destroy_;
to_destroy_ = NULL;
@@ -207,7 +207,7 @@
public:
TestEventDispatcher() {}
- virtual ~TestEventDispatcher() {}
+ ~TestEventDispatcher() override {}
EventDispatchDetails ProcessEvent(EventTarget* target, Event* event) {
return DispatchEvent(target, event);
@@ -215,7 +215,7 @@
private:
// Overridden from EventDispatcherDelegate:
- virtual bool CanDispatchToTarget(EventTarget* target) override {
+ bool CanDispatchToTarget(EventTarget* target) override {
TestTarget* test_target = static_cast<TestTarget*>(target);
return test_target->valid();
}
diff --git a/ui/events/event_processor_unittest.cc b/ui/events/event_processor_unittest.cc
index 33a8162..90b2ad9 100644
--- a/ui/events/event_processor_unittest.cc
+++ b/ui/events/event_processor_unittest.cc
@@ -20,10 +20,10 @@
class EventProcessorTest : public testing::Test {
public:
EventProcessorTest() {}
- virtual ~EventProcessorTest() {}
+ ~EventProcessorTest() override {}
// testing::Test:
- virtual void SetUp() override {
+ void SetUp() override {
processor_.SetRoot(scoped_ptr<EventTarget>(new TestEventTarget()));
processor_.Reset();
root()->SetEventTargeter(make_scoped_ptr(new EventTargeter()));
@@ -78,7 +78,7 @@
class BoundsTestTarget : public TestEventTarget {
public:
BoundsTestTarget() {}
- virtual ~BoundsTestTarget() {}
+ ~BoundsTestTarget() override {}
void set_bounds(gfx::Rect rect) { bounds_ = rect; }
gfx::Rect bounds() const { return bounds_; }
@@ -106,8 +106,8 @@
private:
// EventTarget:
- virtual void ConvertEventToTarget(EventTarget* target,
- LocatedEvent* event) override {
+ void ConvertEventToTarget(EventTarget* target,
+ LocatedEvent* event) override {
event->ConvertLocationToTarget(this,
static_cast<BoundsTestTarget*>(target));
}
@@ -182,10 +182,10 @@
public:
ReDispatchEventHandler(EventProcessor* processor, EventTarget* target)
: processor_(processor), expected_target_(target) {}
- virtual ~ReDispatchEventHandler() {}
+ ~ReDispatchEventHandler() override {}
// TestEventHandler:
- virtual void OnMouseEvent(MouseEvent* event) override {
+ void OnMouseEvent(MouseEvent* event) override {
TestEventHandler::OnMouseEvent(event);
EXPECT_EQ(expected_target_, event->target());
@@ -322,11 +322,11 @@
class IgnoreEventTargeter : public EventTargeter {
public:
IgnoreEventTargeter() {}
- virtual ~IgnoreEventTargeter() {}
+ ~IgnoreEventTargeter() override {}
private:
// EventTargeter:
- virtual bool SubtreeShouldBeExploredForEvent(
+ bool SubtreeShouldBeExploredForEvent(
EventTarget* target, const LocatedEvent& event) override {
return false;
}
@@ -364,16 +364,16 @@
public:
explicit BubblingEventTargeter(TestEventTarget* initial_target)
: initial_target_(initial_target) {}
- virtual ~BubblingEventTargeter() {}
+ ~BubblingEventTargeter() override {}
private:
// EventTargeter:
- virtual EventTarget* FindTargetForEvent(EventTarget* root,
+ EventTarget* FindTargetForEvent(EventTarget* root,
Event* event) override {
return initial_target_;
}
- virtual EventTarget* FindNextBestTarget(EventTarget* previous_target,
+ EventTarget* FindNextBestTarget(EventTarget* previous_target,
Event* event) override {
return previous_target->GetParentTarget();
}
diff --git a/ui/events/event_rewriter_unittest.cc b/ui/events/event_rewriter_unittest.cc
index 08e592f..3129ae3 100644
--- a/ui/events/event_rewriter_unittest.cc
+++ b/ui/events/event_rewriter_unittest.cc
@@ -22,7 +22,7 @@
public:
explicit TestEvent(EventType type)
: Event(type, base::TimeDelta(), 0), unique_id_(next_unique_id_++) {}
- virtual ~TestEvent() {}
+ ~TestEvent() override {}
int unique_id() const { return unique_id_; }
private:
@@ -38,14 +38,14 @@
class TestEventRewriteProcessor : public test::TestEventProcessor {
public:
TestEventRewriteProcessor() {}
- virtual ~TestEventRewriteProcessor() { CheckAllReceived(); }
+ ~TestEventRewriteProcessor() override { CheckAllReceived(); }
void AddExpectedEvent(EventType type) { expected_events_.push_back(type); }
// Test that all expected events have been received.
void CheckAllReceived() { EXPECT_TRUE(expected_events_.empty()); }
// EventProcessor:
- virtual EventDispatchDetails OnEventFromSource(Event* event) override {
+ EventDispatchDetails OnEventFromSource(Event* event) override {
EXPECT_FALSE(expected_events_.empty());
EXPECT_EQ(expected_events_.front(), event->type());
expected_events_.pop_front();
@@ -62,7 +62,7 @@
public:
explicit TestEventRewriteSource(EventProcessor* processor)
: processor_(processor) {}
- virtual EventProcessor* GetEventProcessor() override { return processor_; }
+ EventProcessor* GetEventProcessor() override { return processor_; }
void Send(EventType type) {
scoped_ptr<Event> event(new TestEvent(type));
(void)SendEventToProcessor(event.get());
@@ -83,16 +83,15 @@
CHECK_NE(EVENT_REWRITE_DISPATCH_ANOTHER, status);
}
- virtual EventRewriteStatus RewriteEvent(const Event& event,
- scoped_ptr<Event>* rewritten_event)
+ EventRewriteStatus RewriteEvent(const Event& event,
+ scoped_ptr<Event>* rewritten_event)
override {
if (status_ == EVENT_REWRITE_REWRITTEN)
rewritten_event->reset(new TestEvent(type_));
return status_;
}
- virtual EventRewriteStatus NextDispatchEvent(const Event& last_event,
- scoped_ptr<Event>* new_event)
- override {
+ EventRewriteStatus NextDispatchEvent(const Event& last_event,
+ scoped_ptr<Event>* new_event) override {
NOTREACHED();
return status_;
}
@@ -113,9 +112,8 @@
rules_.insert(std::pair<RewriteCase, RewriteResult>(
RewriteCase(from_state, from_type), r));
}
- virtual EventRewriteStatus RewriteEvent(const Event& event,
- scoped_ptr<Event>* rewritten_event)
- override {
+ EventRewriteStatus RewriteEvent(const Event& event,
+ scoped_ptr<Event>* rewritten_event) override {
RewriteRules::iterator find =
rules_.find(RewriteCase(state_, event.type()));
if (find == rules_.end())
@@ -130,9 +128,8 @@
state_ = find->second.state;
return find->second.status;
}
- virtual EventRewriteStatus NextDispatchEvent(const Event& last_event,
- scoped_ptr<Event>* new_event)
- override {
+ EventRewriteStatus NextDispatchEvent(const Event& last_event,
+ scoped_ptr<Event>* new_event) override {
EXPECT_TRUE(last_rewritten_event_);
const TestEvent* arg_last = static_cast<const TestEvent*>(&last_event);
EXPECT_EQ(last_rewritten_event_->unique_id(), arg_last->unique_id());
diff --git a/ui/events/gesture_detection/gesture_provider_unittest.cc b/ui/events/gesture_detection/gesture_provider_unittest.cc
index da305ff..bf483ef 100644
--- a/ui/events/gesture_detection/gesture_provider_unittest.cc
+++ b/ui/events/gesture_detection/gesture_provider_unittest.cc
@@ -58,7 +58,7 @@
class GestureProviderTest : public testing::Test, public GestureProviderClient {
public:
GestureProviderTest() {}
- virtual ~GestureProviderTest() {}
+ ~GestureProviderTest() override {}
static MockMotionEvent ObtainMotionEvent(base::TimeTicks event_time,
MotionEvent::Action action,
@@ -123,15 +123,15 @@
}
// Test
- virtual void SetUp() override { SetUpWithConfig(GetDefaultConfig()); }
+ void SetUp() override { SetUpWithConfig(GetDefaultConfig()); }
- virtual void TearDown() override {
+ void TearDown() override {
gestures_.clear();
gesture_provider_.reset();
}
// GestureProviderClient
- virtual void OnGestureEvent(const GestureEventData& gesture) override {
+ void OnGestureEvent(const GestureEventData& gesture) override {
if (gesture.type() == ET_GESTURE_SCROLL_BEGIN)
active_scroll_begin_event_.reset(new GestureEventData(gesture));
gestures_.push_back(gesture);
diff --git a/ui/events/gesture_detection/motion_event_buffer_unittest.cc b/ui/events/gesture_detection/motion_event_buffer_unittest.cc
index badbd98..0b77dfe 100644
--- a/ui/events/gesture_detection/motion_event_buffer_unittest.cc
+++ b/ui/events/gesture_detection/motion_event_buffer_unittest.cc
@@ -41,14 +41,14 @@
public MotionEventBufferClient {
public:
MotionEventBufferTest() : needs_flush_(false) {}
- virtual ~MotionEventBufferTest() {}
+ ~MotionEventBufferTest() override {}
// MotionEventBufferClient implementation.
- virtual void ForwardMotionEvent(const MotionEvent& event) override {
+ void ForwardMotionEvent(const MotionEvent& event) override {
forwarded_events_.push_back(event.Clone().release());
}
- virtual void SetNeedsFlush() override { needs_flush_ = true; }
+ void SetNeedsFlush() override { needs_flush_ = true; }
bool GetAndResetNeedsFlush() {
bool needs_flush = needs_flush_;
diff --git a/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc b/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc
index d8a2551..fa31056 100644
--- a/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc
+++ b/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc
@@ -23,20 +23,20 @@
public:
TouchDispositionGestureFilterTest()
: cancel_after_next_gesture_(false), sent_gesture_count_(0) {}
- virtual ~TouchDispositionGestureFilterTest() {}
+ ~TouchDispositionGestureFilterTest() override {}
// testing::Test
- virtual void SetUp() override {
+ void SetUp() override {
queue_.reset(new TouchDispositionGestureFilter(this));
touch_event_.set_flags(kDefaultEventFlags);
}
- virtual void TearDown() override {
+ void TearDown() override {
queue_.reset();
}
// TouchDispositionGestureFilterClient
- virtual void ForwardGestureEvent(const GestureEventData& event) override {
+ void ForwardGestureEvent(const GestureEventData& event) override {
++sent_gesture_count_;
last_sent_gesture_.reset(new GestureEventData(event));
sent_gestures_.push_back(event.type());
diff --git a/ui/events/gesture_detection/velocity_tracker_unittest.cc b/ui/events/gesture_detection/velocity_tracker_unittest.cc
index 9b45053..c5cf15c 100644
--- a/ui/events/gesture_detection/velocity_tracker_unittest.cc
+++ b/ui/events/gesture_detection/velocity_tracker_unittest.cc
@@ -43,7 +43,7 @@
class VelocityTrackerTest : public testing::Test {
public:
VelocityTrackerTest() {}
- virtual ~VelocityTrackerTest() {}
+ ~VelocityTrackerTest() override {}
protected:
static MockMotionEvent Sample(MotionEvent::Action action,
diff --git a/ui/events/gestures/gesture_provider_impl.h b/ui/events/gestures/gesture_provider_impl.h
index 118c78b..fd907e1 100644
--- a/ui/events/gestures/gesture_provider_impl.h
+++ b/ui/events/gestures/gesture_provider_impl.h
@@ -27,7 +27,7 @@
class EVENTS_EXPORT GestureProviderImpl : public GestureProviderClient {
public:
GestureProviderImpl(GestureProviderImplClient* client);
- virtual ~GestureProviderImpl();
+ ~GestureProviderImpl() override;
bool OnTouchEvent(const TouchEvent& event);
void OnTouchEventAck(bool event_consumed);
@@ -35,7 +35,7 @@
ScopedVector<GestureEvent>* GetAndResetPendingGestures();
// GestureProviderClient implementation
- virtual void OnGestureEvent(const GestureEventData& gesture) override;
+ void OnGestureEvent(const GestureEventData& gesture) override;
private:
bool IsConsideredDoubleTap(const GestureEventData& previous_tap,
diff --git a/ui/events/gestures/gesture_provider_impl_unittest.cc b/ui/events/gestures/gesture_provider_impl_unittest.cc
index 66cc808..fadedc1 100644
--- a/ui/events/gestures/gesture_provider_impl_unittest.cc
+++ b/ui/events/gestures/gesture_provider_impl_unittest.cc
@@ -15,15 +15,15 @@
public:
GestureProviderImplTest() {}
- virtual ~GestureProviderImplTest() {}
+ ~GestureProviderImplTest() override {}
- virtual void OnGestureEvent(GestureEvent* event) override {}
+ void OnGestureEvent(GestureEvent* event) override {}
- virtual void SetUp() override {
+ void SetUp() override {
provider_.reset(new GestureProviderImpl(this));
}
- virtual void TearDown() override { provider_.reset(); }
+ void TearDown() override { provider_.reset(); }
GestureProviderImpl* provider() { return provider_.get(); }
diff --git a/ui/events/gestures/gesture_recognizer_impl.h b/ui/events/gestures/gesture_recognizer_impl.h
index d87045a..9957356 100644
--- a/ui/events/gestures/gesture_recognizer_impl.h
+++ b/ui/events/gestures/gesture_recognizer_impl.h
@@ -31,22 +31,22 @@
typedef std::map<int, GestureConsumer*> TouchIdToConsumerMap;
GestureRecognizerImpl();
- virtual ~GestureRecognizerImpl();
+ ~GestureRecognizerImpl() override;
std::vector<GestureEventHelper*>& helpers() { return helpers_; }
// Overridden from GestureRecognizer
- virtual GestureConsumer* GetTouchLockedTarget(
+ GestureConsumer* GetTouchLockedTarget(
const TouchEvent& event) override;
- virtual GestureConsumer* GetTargetForGestureEvent(
+ GestureConsumer* GetTargetForGestureEvent(
const GestureEvent& event) override;
- virtual GestureConsumer* GetTargetForLocation(
+ GestureConsumer* GetTargetForLocation(
const gfx::PointF& location, int source_device_id) override;
- virtual void TransferEventsTo(GestureConsumer* current_consumer,
- GestureConsumer* new_consumer) override;
- virtual bool GetLastTouchPointForTarget(GestureConsumer* consumer,
- gfx::PointF* point) override;
- virtual bool CancelActiveTouches(GestureConsumer* consumer) override;
+ void TransferEventsTo(GestureConsumer* current_consumer,
+ GestureConsumer* new_consumer) override;
+ bool GetLastTouchPointForTarget(GestureConsumer* consumer,
+ gfx::PointF* point) override;
+ bool CancelActiveTouches(GestureConsumer* consumer) override;
protected:
virtual GestureProviderImpl* GetGestureProviderForConsumer(
@@ -59,26 +59,25 @@
void DispatchGestureEvent(GestureEvent* event);
// Overridden from GestureRecognizer
- virtual bool ProcessTouchEventPreDispatch(const TouchEvent& event,
- GestureConsumer* consumer) override;
+ bool ProcessTouchEventPreDispatch(const TouchEvent& event,
+ GestureConsumer* consumer) override;
- virtual Gestures* ProcessTouchEventPostDispatch(
+ Gestures* ProcessTouchEventPostDispatch(
const TouchEvent& event,
ui::EventResult result,
GestureConsumer* consumer) override;
- virtual Gestures* ProcessTouchEventOnAsyncAck(
+ Gestures* ProcessTouchEventOnAsyncAck(
const TouchEvent& event,
ui::EventResult result,
GestureConsumer* consumer) override;
- virtual bool CleanupStateForConsumer(GestureConsumer* consumer)
- override;
- virtual void AddGestureEventHelper(GestureEventHelper* helper) override;
- virtual void RemoveGestureEventHelper(GestureEventHelper* helper) override;
+ bool CleanupStateForConsumer(GestureConsumer* consumer) override;
+ void AddGestureEventHelper(GestureEventHelper* helper) override;
+ void RemoveGestureEventHelper(GestureEventHelper* helper) override;
// Overridden from GestureProviderImplClient
- virtual void OnGestureEvent(GestureEvent* event) override;
+ void OnGestureEvent(GestureEvent* event) override;
// Convenience method to find the GestureEventHelper that can dispatch events
// to a specific |consumer|.
diff --git a/ui/events/gestures/motion_event_impl.h b/ui/events/gestures/motion_event_impl.h
index cac09e8..e2b90a2 100644
--- a/ui/events/gestures/motion_event_impl.h
+++ b/ui/events/gestures/motion_event_impl.h
@@ -19,31 +19,31 @@
class EVENTS_EXPORT MotionEventImpl : public MotionEvent {
public:
MotionEventImpl();
- virtual ~MotionEventImpl();
+ ~MotionEventImpl() override;
void OnTouch(const TouchEvent& touch);
// MotionEvent implementation.
- virtual int GetId() const override;
- virtual Action GetAction() const override;
- virtual int GetActionIndex() const override;
- virtual size_t GetPointerCount() const override;
- virtual int GetPointerId(size_t pointer_index) const override;
- virtual float GetX(size_t pointer_index) const override;
- virtual float GetY(size_t pointer_index) const override;
- virtual float GetRawX(size_t pointer_index) const override;
- virtual float GetRawY(size_t pointer_index) const override;
- virtual float GetTouchMajor(size_t pointer_index) const override;
- virtual float GetTouchMinor(size_t pointer_index) const override;
- virtual float GetOrientation(size_t pointer_index) const override;
- virtual float GetPressure(size_t pointer_index) const override;
- virtual ToolType GetToolType(size_t pointer_index) const override;
- virtual int GetButtonState() const override;
- virtual int GetFlags() const override;
- virtual base::TimeTicks GetEventTime() const override;
+ int GetId() const override;
+ Action GetAction() const override;
+ int GetActionIndex() const override;
+ size_t GetPointerCount() const override;
+ int GetPointerId(size_t pointer_index) const override;
+ float GetX(size_t pointer_index) const override;
+ float GetY(size_t pointer_index) const override;
+ float GetRawX(size_t pointer_index) const override;
+ float GetRawY(size_t pointer_index) const override;
+ float GetTouchMajor(size_t pointer_index) const override;
+ float GetTouchMinor(size_t pointer_index) const override;
+ float GetOrientation(size_t pointer_index) const override;
+ float GetPressure(size_t pointer_index) const override;
+ ToolType GetToolType(size_t pointer_index) const override;
+ int GetButtonState() const override;
+ int GetFlags() const override;
+ base::TimeTicks GetEventTime() const override;
- virtual scoped_ptr<MotionEvent> Clone() const override;
- virtual scoped_ptr<MotionEvent> Cancel() const override;
+ scoped_ptr<MotionEvent> Clone() const override;
+ scoped_ptr<MotionEvent> Cancel() const override;
int GetSourceDeviceId(size_t pointer_index) const;
diff --git a/ui/events/platform/platform_event_builder_x_unittest.cc b/ui/events/platform/platform_event_builder_x_unittest.cc
index ad0d438..40b4f40 100644
--- a/ui/events/platform/platform_event_builder_x_unittest.cc
+++ b/ui/events/platform/platform_event_builder_x_unittest.cc
@@ -16,7 +16,7 @@
class PlatformEventBuilderXTest : public testing::Test {
public:
PlatformEventBuilderXTest() {}
- virtual ~PlatformEventBuilderXTest() {}
+ ~PlatformEventBuilderXTest() override {}
void SetUp() override {
DeviceDataManagerX11::CreateInstance();
diff --git a/ui/events/platform/platform_event_source_unittest.cc b/ui/events/platform/platform_event_source_unittest.cc
index cc34960..cc305cb 100644
--- a/ui/events/platform/platform_event_source_unittest.cc
+++ b/ui/events/platform/platform_event_source_unittest.cc
@@ -48,7 +48,7 @@
TestPlatformEventSource()
: stop_stream_(false) {
}
- virtual ~TestPlatformEventSource() {}
+ ~TestPlatformEventSource() override {}
uint32_t Dispatch(const PlatformEvent& event) { return DispatchEvent(event); }
@@ -65,7 +65,7 @@
}
// PlatformEventSource:
- virtual void StopCurrentEventStream() override {
+ void StopCurrentEventStream() override {
stop_stream_ = true;
}
@@ -83,7 +83,7 @@
stop_stream_(false) {
PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
}
- virtual ~TestPlatformEventDispatcher() {
+ ~TestPlatformEventDispatcher() override {
PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
}
@@ -93,11 +93,11 @@
protected:
// PlatformEventDispatcher:
- virtual bool CanDispatchEvent(const PlatformEvent& event) override {
+ bool CanDispatchEvent(const PlatformEvent& event) override {
return true;
}
- virtual uint32_t DispatchEvent(const PlatformEvent& event) override {
+ uint32_t DispatchEvent(const PlatformEvent& event) override {
list_->push_back(id_);
return post_dispatch_action_;
}
@@ -117,17 +117,17 @@
: id_(id), list_(list) {
PlatformEventSource::GetInstance()->AddPlatformEventObserver(this);
}
- virtual ~TestPlatformEventObserver() {
+ ~TestPlatformEventObserver() override {
PlatformEventSource::GetInstance()->RemovePlatformEventObserver(this);
}
protected:
// PlatformEventObserver:
- virtual void WillProcessEvent(const PlatformEvent& event) override {
+ void WillProcessEvent(const PlatformEvent& event) override {
list_->push_back(id_);
}
- virtual void DidProcessEvent(const PlatformEvent& event) override {}
+ void DidProcessEvent(const PlatformEvent& event) override {}
private:
int id_;
@@ -139,13 +139,13 @@
class PlatformEventTest : public testing::Test {
public:
PlatformEventTest() {}
- virtual ~PlatformEventTest() {}
+ ~PlatformEventTest() override {}
TestPlatformEventSource* source() { return source_.get(); }
protected:
// testing::Test:
- virtual void SetUp() override {
+ void SetUp() override {
source_.reset(new TestPlatformEventSource());
}
@@ -334,7 +334,7 @@
public:
RunCallbackDuringDispatch(int id, std::vector<int>* list)
: TestPlatformEventDispatcher(id, list) {}
- virtual ~RunCallbackDuringDispatch() {}
+ ~RunCallbackDuringDispatch() override {}
void set_callback(const base::Closure& callback) {
callback_ = callback;
@@ -342,7 +342,7 @@
protected:
// PlatformEventDispatcher:
- virtual uint32_t DispatchEvent(const PlatformEvent& event) override {
+ uint32_t DispatchEvent(const PlatformEvent& event) override {
if (!callback_.is_null())
callback_.Run();
return TestPlatformEventDispatcher::DispatchEvent(event);
@@ -497,7 +497,7 @@
class PlatformEventTestWithMessageLoop : public PlatformEventTest {
public:
PlatformEventTestWithMessageLoop() {}
- virtual ~PlatformEventTestWithMessageLoop() {}
+ ~PlatformEventTestWithMessageLoop() override {}
void Run() {
message_loop_.PostTask(
@@ -530,7 +530,7 @@
: public PlatformEventTestWithMessageLoop {
public:
// PlatformEventTestWithMessageLoop:
- virtual void RunTestImpl() override {
+ void RunTestImpl() override {
std::vector<int> list;
TestPlatformEventDispatcher dispatcher(10, &list);
TestPlatformEventObserver observer(15, &list);
@@ -569,7 +569,7 @@
public:
DestroyScopedHandleDispatcher(int id, std::vector<int>* list)
: TestPlatformEventDispatcher(id, list) {}
- virtual ~DestroyScopedHandleDispatcher() {}
+ ~DestroyScopedHandleDispatcher() override {}
void SetScopedHandle(scoped_ptr<ScopedEventDispatcher> handler) {
handler_ = handler.Pass();
@@ -581,11 +581,11 @@
private:
// PlatformEventDispatcher:
- virtual bool CanDispatchEvent(const PlatformEvent& event) override {
+ bool CanDispatchEvent(const PlatformEvent& event) override {
return true;
}
- virtual uint32_t DispatchEvent(const PlatformEvent& event) override {
+ uint32_t DispatchEvent(const PlatformEvent& event) override {
handler_.reset();
uint32_t action = TestPlatformEventDispatcher::DispatchEvent(event);
if (!callback_.is_null()) {
@@ -640,7 +640,7 @@
}
// PlatformEventTestWithMessageLoop:
- virtual void RunTestImpl() override {
+ void RunTestImpl() override {
std::vector<int> list;
TestPlatformEventDispatcher dispatcher(10, &list);
TestPlatformEventObserver observer(15, &list);
@@ -740,7 +740,7 @@
}
// PlatformEventTestWithMessageLoop:
- virtual void RunTestImpl() override {
+ void RunTestImpl() override {
std::vector<int> list;
TestPlatformEventDispatcher dispatcher(10, &list);
TestPlatformEventObserver observer(15, &list);
diff --git a/ui/events/platform/x11/device_data_manager_x11.h b/ui/events/platform/x11/device_data_manager_x11.h
index 9f064f2..801b1c5 100644
--- a/ui/events/platform/x11/device_data_manager_x11.h
+++ b/ui/events/platform/x11/device_data_manager_x11.h
@@ -238,7 +238,7 @@
private:
DeviceDataManagerX11();
- virtual ~DeviceDataManagerX11();
+ ~DeviceDataManagerX11() override;
// Initialize the XInput related system information.
bool InitializeXInputInternal();
diff --git a/ui/events/platform/x11/platform_event_utils_x_unittest.cc b/ui/events/platform/x11/platform_event_utils_x_unittest.cc
index 1d89404..cba2844 100644
--- a/ui/events/platform/x11/platform_event_utils_x_unittest.cc
+++ b/ui/events/platform/x11/platform_event_utils_x_unittest.cc
@@ -85,9 +85,9 @@
class PlatformEventUtilsXTest : public testing::Test {
public:
PlatformEventUtilsXTest() {}
- virtual ~PlatformEventUtilsXTest() {}
+ ~PlatformEventUtilsXTest() override {}
- virtual void SetUp() override {
+ void SetUp() override {
DeviceDataManagerX11::CreateInstance();
ui::TouchFactory::GetInstance()->ResetForTest();
}
diff --git a/ui/events/platform/x11/x11_event_source.h b/ui/events/platform/x11/x11_event_source.h
index 206ca5a..6501eb7 100644
--- a/ui/events/platform/x11/x11_event_source.h
+++ b/ui/events/platform/x11/x11_event_source.h
@@ -24,7 +24,7 @@
class EVENTS_EXPORT X11EventSource : public PlatformEventSource {
public:
explicit X11EventSource(XDisplay* display);
- virtual ~X11EventSource();
+ ~X11EventSource() override;
static X11EventSource* GetInstance();
@@ -48,8 +48,8 @@
private:
// PlatformEventSource:
- virtual uint32_t DispatchEvent(XEvent* xevent) override;
- virtual void StopCurrentEventStream() override;
+ uint32_t DispatchEvent(XEvent* xevent) override;
+ void StopCurrentEventStream() override;
// The connection to the X11 server used to receive the events.
XDisplay* display_;
diff --git a/ui/events/platform/x11/x11_event_source_libevent.cc b/ui/events/platform/x11/x11_event_source_libevent.cc
index 8ad7931..0df1977 100644
--- a/ui/events/platform/x11/x11_event_source_libevent.cc
+++ b/ui/events/platform/x11/x11_event_source_libevent.cc
@@ -22,7 +22,7 @@
AddEventWatcher();
}
- virtual ~X11EventSourceLibevent() {
+ ~X11EventSourceLibevent() override {
}
private:
@@ -39,16 +39,16 @@
}
// PlatformEventSource:
- virtual void OnDispatcherListChanged() override {
+ void OnDispatcherListChanged() override {
AddEventWatcher();
}
// base::MessagePumpLibevent::Watcher:
- virtual void OnFileCanReadWithoutBlocking(int fd) override {
+ void OnFileCanReadWithoutBlocking(int fd) override {
DispatchXEvents();
}
- virtual void OnFileCanWriteWithoutBlocking(int fd) override {
+ void OnFileCanWriteWithoutBlocking(int fd) override {
NOTREACHED();
}
diff --git a/ui/gfx/animation/animation.h b/ui/gfx/animation/animation.h
index 81e8e2b..d7d7d3a 100644
--- a/ui/gfx/animation/animation.h
+++ b/ui/gfx/animation/animation.h
@@ -82,7 +82,7 @@
// AnimationContainer::Element overrides
void SetStartTime(base::TimeTicks start_time) override;
- virtual void Step(base::TimeTicks time_now) = 0;
+ void Step(base::TimeTicks time_now) override = 0;
base::TimeDelta GetTimerInterval() const override;
private:
diff --git a/ui/gl/android/surface_texture.cc b/ui/gl/android/surface_texture.cc
index bf9012a..a9f52dc 100644
--- a/ui/gl/android/surface_texture.cc
+++ b/ui/gl/android/surface_texture.cc
@@ -87,19 +87,6 @@
env->ReleaseFloatArrayElements(jmatrix.obj(), elements, JNI_ABORT);
}
-void SurfaceTexture::SetDefaultBufferSize(int width, int height) {
- JNIEnv* env = base::android::AttachCurrentThread();
-
- if (width > 0 && height > 0) {
- Java_SurfaceTexturePlatformWrapper_setDefaultBufferSize(
- env, j_surface_texture_.obj(), static_cast<jint>(width),
- static_cast<jint>(height));
- } else {
- LOG(WARNING) << "Not setting surface texture buffer size - "
- "width or height is 0";
- }
-}
-
void SurfaceTexture::AttachToGLContext() {
if (GlContextMethodsAvailable()) {
int texture_id;
diff --git a/ui/gl/android/surface_texture.h b/ui/gl/android/surface_texture.h
index 05bc5a3..b22e5c4 100644
--- a/ui/gl/android/surface_texture.h
+++ b/ui/gl/android/surface_texture.h
@@ -46,9 +46,6 @@
// texture image set by the most recent call to updateTexImage.
void GetTransformMatrix(float mtx[16]);
- // Set the default size of the image buffers.
- void SetDefaultBufferSize(int width, int height);
-
// Attach the SurfaceTexture to the texture currently bound to
// GL_TEXTURE_EXTERNAL_OES.
void AttachToGLContext();
diff --git a/ui/gl/gl_context_egl.cc b/ui/gl/gl_context_egl.cc
index 5fa2c44..950558b 100644
--- a/ui/gl/gl_context_egl.cc
+++ b/ui/gl/gl_context_egl.cc
@@ -4,6 +4,7 @@
#include "ui/gl/gl_context_egl.h"
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/trace_event/trace_event.h"
@@ -38,12 +39,18 @@
DCHECK(compatible_surface);
DCHECK(!context_);
- static const EGLint kContextAttributes[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGLint context_client_version = 2;
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableUnsafeES3APIs)) {
+ context_client_version = 3;
+ }
+
+ const EGLint kContextAttributes[] = {
+ EGL_CONTEXT_CLIENT_VERSION, context_client_version,
EGL_NONE
};
- static const EGLint kContextRobustnessAttributes[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
+ const EGLint kContextRobustnessAttributes[] = {
+ EGL_CONTEXT_CLIENT_VERSION, context_client_version,
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT,
EGL_LOSE_CONTEXT_ON_RESET_EXT,
EGL_NONE
diff --git a/ui/gl/gl_image_memory.cc b/ui/gl/gl_image_memory.cc
index 6b9a519..ca106b7 100644
--- a/ui/gl/gl_image_memory.cc
+++ b/ui/gl/gl_image_memory.cc
@@ -183,30 +183,6 @@
return false;
}
-// static
-bool GLImageMemory::ValidSize(const gfx::Size& size,
- gfx::GpuMemoryBuffer::Format format) {
- switch (format) {
- case gfx::GpuMemoryBuffer::ATC:
- case gfx::GpuMemoryBuffer::ATCIA:
- case gfx::GpuMemoryBuffer::DXT1:
- case gfx::GpuMemoryBuffer::DXT5:
- case gfx::GpuMemoryBuffer::ETC1:
- // Compressed images must have a width and height that's evenly divisible
- // by the block size.
- return size.width() % 4 == 0 && size.height() % 4 == 0;
- case gfx::GpuMemoryBuffer::RGBA_8888:
- case gfx::GpuMemoryBuffer::BGRA_8888:
- return true;
- case gfx::GpuMemoryBuffer::RGBX_8888:
- NOTREACHED();
- return false;
- }
-
- NOTREACHED();
- return false;
-}
-
bool GLImageMemory::Initialize(const unsigned char* memory,
gfx::GpuMemoryBuffer::Format format) {
if (!ValidInternalFormat(internalformat_)) {
@@ -221,6 +197,8 @@
DCHECK(memory);
DCHECK(!memory_);
+ DCHECK_IMPLIES(IsCompressedFormat(format), size_.width() % 4 == 0);
+ DCHECK_IMPLIES(IsCompressedFormat(format), size_.height() % 4 == 0);
memory_ = memory;
format_ = format;
return true;
diff --git a/ui/gl/gl_image_memory.h b/ui/gl/gl_image_memory.h
index befc3a8..a50a380 100644
--- a/ui/gl/gl_image_memory.h
+++ b/ui/gl/gl_image_memory.h
@@ -26,9 +26,6 @@
gfx::GpuMemoryBuffer::Format format,
size_t* stride_in_bytes);
- static bool ValidSize(const gfx::Size& size,
- gfx::GpuMemoryBuffer::Format format);
-
bool Initialize(const unsigned char* memory,
gfx::GpuMemoryBuffer::Format format);
diff --git a/ui/gl/gl_image_shared_memory.cc b/ui/gl/gl_image_shared_memory.cc
index 363ebf5..d9e31a7 100644
--- a/ui/gl/gl_image_shared_memory.cc
+++ b/ui/gl/gl_image_shared_memory.cc
@@ -18,9 +18,6 @@
if (size.IsEmpty())
return false;
- if (!GLImageMemory::ValidSize(size, format))
- return false;
-
size_t stride_in_bytes = 0;
if (!GLImageMemory::StrideInBytes(size.width(), format, &stride_in_bytes))
return false;
diff --git a/ui/gl/gl_surface.h b/ui/gl/gl_surface.h
index 48d7cd2..da70422 100644
--- a/ui/gl/gl_surface.h
+++ b/ui/gl/gl_surface.h
@@ -156,6 +156,15 @@
static scoped_refptr<GLSurface> CreateViewGLSurface(
gfx::AcceleratedWidget window);
+#if defined(USE_OZONE)
+ // Create a GL surface that renders directly into a window with surfaceless
+ // semantics - there is no default framebuffer and the primary surface must
+ // be presented as an overlay. If surfaceless mode is not supported or
+ // enabled it will return a null pointer.
+ static scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface(
+ gfx::AcceleratedWidget window);
+#endif // defined(USE_OZONE)
+
// Create a GL surface used for offscreen rendering.
static scoped_refptr<GLSurface> CreateOffscreenGLSurface(
const gfx::Size& size);
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
index 2dcdc88..61c3c05 100644
--- a/ui/gl/gl_surface_egl.cc
+++ b/ui/gl/gl_surface_egl.cc
@@ -37,6 +37,10 @@
#define EGL_FIXED_SIZE_ANGLE 0x3201
#endif
+#if !defined(EGL_OPENGL_ES3_BIT)
+#define EGL_OPENGL_ES3_BIT 0x00000040
+#endif
+
#if defined(OS_WIN)
// From ANGLE's egl/eglext.h.
@@ -172,13 +176,18 @@
// Choose an EGL configuration.
// On X this is only used for PBuffer surfaces.
- static const EGLint kConfigAttribs[] = {
+ EGLint renderable_type = EGL_OPENGL_ES2_BIT;
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableUnsafeES3APIs)) {
+ renderable_type = EGL_OPENGL_ES3_BIT;
+ }
+ const EGLint kConfigAttribs[] = {
EGL_BUFFER_SIZE, 32,
EGL_ALPHA_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_RED_SIZE, 8,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_RENDERABLE_TYPE, renderable_type,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT,
EGL_NONE
};
diff --git a/ui/gl/gl_surface_ozone.cc b/ui/gl/gl_surface_ozone.cc
index cba706b..47ea8d6 100644
--- a/ui/gl/gl_surface_ozone.cc
+++ b/ui/gl/gl_surface_ozone.cc
@@ -4,16 +4,20 @@
#include "ui/gl/gl_surface.h"
+#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_image.h"
+#include "ui/gl/gl_image_linux_dma_buffer.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_surface_egl.h"
#include "ui/gl/gl_surface_osmesa.h"
#include "ui/gl/gl_surface_stub.h"
+#include "ui/gl/scoped_binders.h"
#include "ui/gl/scoped_make_current.h"
+#include "ui/ozone/public/native_pixmap.h"
#include "ui/ozone/public/surface_factory_ozone.h"
#include "ui/ozone/public/surface_ozone_egl.h"
@@ -157,15 +161,15 @@
return SwapBuffersAsync(callback);
}
- private:
+ protected:
~GLSurfaceOzoneSurfaceless() override {
Destroy(); // EGL surface must be destroyed before SurfaceOzone
}
bool Flush() {
glFlush();
- // TODO: the following should be replaced by a per surface flush as it gets
- // implemented in GL drivers.
+ // TODO: crbug.com/462360 the following should be replaced by a per surface
+ // flush as it gets implemented in GL drivers.
if (has_implicit_external_sync_) {
const EGLint attrib_list[] = {
EGL_SYNC_CONDITION_KHR,
@@ -182,6 +186,8 @@
} else {
return false;
}
+ } else if (ozone_surface_->IsUniversalDisplayLinkDevice()) {
+ glFinish();
}
return true;
}
@@ -194,6 +200,157 @@
DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneSurfaceless);
};
+// This provides surface-like semantics implemented through surfaceless.
+// A framebuffer is bound automatically.
+class GL_EXPORT GLSurfaceOzoneSurfacelessSurfaceImpl
+ : public GLSurfaceOzoneSurfaceless {
+ public:
+ GLSurfaceOzoneSurfacelessSurfaceImpl(
+ scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface,
+ AcceleratedWidget widget)
+ : GLSurfaceOzoneSurfaceless(ozone_surface.Pass(), widget),
+ fbo_(0),
+ current_surface_(0) {
+ for (auto& texture : textures_)
+ texture = 0;
+ }
+
+ unsigned int GetBackingFrameBufferObject() override { return fbo_; }
+
+ bool OnMakeCurrent(GLContext* context) override {
+ if (!fbo_) {
+ glGenFramebuffersEXT(1, &fbo_);
+ if (!fbo_)
+ return false;
+ glGenTextures(arraysize(textures_), textures_);
+ if (!CreatePixmaps())
+ return false;
+ }
+ BindFramebuffer();
+ glBindFramebufferEXT(GL_FRAMEBUFFER, fbo_);
+ return SurfacelessEGL::OnMakeCurrent(context);
+ }
+
+ bool Resize(const gfx::Size& size) override {
+ if (size == GetSize())
+ return true;
+ return GLSurfaceOzoneSurfaceless::Resize(size) && CreatePixmaps();
+ }
+
+ bool SupportsPostSubBuffer() override { return false; }
+
+ bool SwapBuffers() override {
+ if (!images_[current_surface_]->ScheduleOverlayPlane(
+ widget_, 0, OverlayTransform::OVERLAY_TRANSFORM_NONE,
+ gfx::Rect(GetSize()), gfx::RectF(1, 1)))
+ return false;
+ if (!GLSurfaceOzoneSurfaceless::SwapBuffers())
+ return false;
+ current_surface_ ^= 1;
+ BindFramebuffer();
+ return true;
+ }
+
+ bool SwapBuffersAsync(const SwapCompletionCallback& callback) override {
+ if (!images_[current_surface_]->ScheduleOverlayPlane(
+ widget_, 0, OverlayTransform::OVERLAY_TRANSFORM_NONE,
+ gfx::Rect(GetSize()), gfx::RectF(1, 1)))
+ return false;
+ if (!GLSurfaceOzoneSurfaceless::SwapBuffersAsync(callback))
+ return false;
+ current_surface_ ^= 1;
+ BindFramebuffer();
+ return true;
+ }
+
+ void Destroy() override {
+ GLContext* current_context = GLContext::GetCurrent();
+ DCHECK(current_context && current_context->IsCurrent(this));
+ glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
+ if (fbo_) {
+ glDeleteTextures(arraysize(textures_), textures_);
+ for (auto& texture : textures_)
+ texture = 0;
+ glDeleteFramebuffersEXT(1, &fbo_);
+ fbo_ = 0;
+ }
+ for (auto image : images_) {
+ if (image)
+ image->Destroy(true);
+ }
+ }
+
+ private:
+ class SurfaceImage : public GLImageLinuxDMABuffer {
+ public:
+ SurfaceImage(const gfx::Size& size, unsigned internalformat)
+ : GLImageLinuxDMABuffer(size, internalformat) {}
+
+ bool Initialize(scoped_refptr<ui::NativePixmap> pixmap,
+ gfx::GpuMemoryBuffer::Format format) {
+ base::FileDescriptor handle(pixmap->GetDmaBufFd(), false);
+ if (!GLImageLinuxDMABuffer::Initialize(handle, format,
+ pixmap->GetDmaBufPitch()))
+ return false;
+ pixmap_ = pixmap;
+ return true;
+ }
+ bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
+ int z_order,
+ gfx::OverlayTransform transform,
+ const gfx::Rect& bounds_rect,
+ const gfx::RectF& crop_rect) override {
+ return ui::SurfaceFactoryOzone::GetInstance()->ScheduleOverlayPlane(
+ widget, z_order, transform, pixmap_, bounds_rect, crop_rect);
+ }
+
+ private:
+ ~SurfaceImage() override {}
+
+ scoped_refptr<ui::NativePixmap> pixmap_;
+ };
+
+ ~GLSurfaceOzoneSurfacelessSurfaceImpl() override {
+ DCHECK(!fbo_);
+ for (size_t i = 0; i < arraysize(textures_); i++)
+ DCHECK(!textures_[i]) << "texture " << i << " not released";
+ }
+
+ void BindFramebuffer() {
+ ScopedFrameBufferBinder fb(fbo_);
+ glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_TEXTURE_2D, textures_[current_surface_], 0);
+ }
+
+ bool CreatePixmaps() {
+ if (!fbo_)
+ return true;
+ for (size_t i = 0; i < arraysize(textures_); i++) {
+ scoped_refptr<ui::NativePixmap> pixmap =
+ ui::SurfaceFactoryOzone::GetInstance()->CreateNativePixmap(
+ widget_, GetSize(), ui::SurfaceFactoryOzone::RGBA_8888,
+ ui::SurfaceFactoryOzone::SCANOUT);
+ if (!pixmap)
+ return false;
+ scoped_refptr<SurfaceImage> image = new SurfaceImage(GetSize(), GL_RGBA);
+ if (!image->Initialize(pixmap, gfx::GpuMemoryBuffer::Format::BGRA_8888))
+ return false;
+ images_[i] = image;
+ // Bind image to texture.
+ ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]);
+ if (!images_[i]->BindTexImage(GL_TEXTURE_2D))
+ return false;
+ }
+ return true;
+ }
+
+ GLuint fbo_;
+ GLuint textures_[2];
+ scoped_refptr<GLImage> images_[2];
+ int current_surface_;
+ DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneSurfacelessSurfaceImpl);
+};
+
} // namespace
// static
@@ -215,6 +372,27 @@
}
// static
+scoped_refptr<GLSurface> GLSurface::CreateSurfacelessViewGLSurface(
+ gfx::AcceleratedWidget window) {
+ if (GetGLImplementation() == kGLImplementationEGLGLES2 &&
+ window != kNullAcceleratedWidget &&
+ GLSurfaceEGL::IsEGLSurfacelessContextSupported() &&
+ ui::SurfaceFactoryOzone::GetInstance()->CanShowPrimaryPlaneAsOverlay()) {
+ scoped_ptr<ui::SurfaceOzoneEGL> surface_ozone =
+ ui::SurfaceFactoryOzone::GetInstance()
+ ->CreateSurfacelessEGLSurfaceForWidget(window);
+ if (!surface_ozone)
+ return nullptr;
+ scoped_refptr<GLSurface> surface;
+ surface = new GLSurfaceOzoneSurfaceless(surface_ozone.Pass(), window);
+ if (surface->Initialize())
+ return surface;
+ }
+
+ return nullptr;
+}
+
+// static
scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface(
gfx::AcceleratedWidget window) {
if (GetGLImplementation() == kGLImplementationOSMesaGL) {
@@ -234,7 +412,8 @@
->CreateSurfacelessEGLSurfaceForWidget(window);
if (!surface_ozone)
return NULL;
- surface = new GLSurfaceOzoneSurfaceless(surface_ozone.Pass(), window);
+ surface = new GLSurfaceOzoneSurfacelessSurfaceImpl(surface_ozone.Pass(),
+ window);
} else {
scoped_ptr<ui::SurfaceOzoneEGL> surface_ozone =
ui::SurfaceFactoryOzone::GetInstance()->CreateEGLSurfaceForWidget(
diff --git a/ui/gl/gl_switches.cc b/ui/gl/gl_switches.cc
index 479ff69..8817156 100644
--- a/ui/gl/gl_switches.cc
+++ b/ui/gl/gl_switches.cc
@@ -58,6 +58,9 @@
// On Windows only: use the WARP software rasterizer in the GPU process.
const char kUseWarp[] = "use-warp";
+// Enable OpenGL ES 3 APIs without proper service side validation.
+const char kEnableUnsafeES3APIs[] = "enable-unsafe-es3-apis";
+
// Disables GL drawing operations which produce pixel output. With this
// the GL output will not be correct but tests will run faster.
const char kDisableGLDrawingForTests[] = "disable-gl-drawing-for-tests";
@@ -74,6 +77,7 @@
kDisableD3D11,
kEnableGPUServiceLogging,
kEnableGPUServiceTracing,
+ kEnableUnsafeES3APIs,
kGpuNoContextLost,
kDisableGLDrawingForTests,
kOverrideUseGLWithOSMesaForTests,
diff --git a/ui/gl/gl_switches.h b/ui/gl/gl_switches.h
index ce27df0..0715ad9 100644
--- a/ui/gl/gl_switches.h
+++ b/ui/gl/gl_switches.h
@@ -36,6 +36,7 @@
GL_EXPORT extern const char kTestGLLib[];
GL_EXPORT extern const char kUseGpuInTests[];
GL_EXPORT extern const char kUseWarp[];
+GL_EXPORT extern const char kEnableUnsafeES3APIs[];
// These flags are used by the test harness code, not passed in by users.
GL_EXPORT extern const char kDisableGLDrawingForTests[];
diff --git a/ui/gl/gpu_timing.cc b/ui/gl/gpu_timing.cc
index 22a4a64..a3b697f 100644
--- a/ui/gl/gpu_timing.cc
+++ b/ui/gl/gpu_timing.cc
@@ -30,6 +30,17 @@
return new GPUTimingClient(this);
}
+uint32_t GPUTiming::GetDisjointCount() {
+ if (timer_type_ == kTimerTypeDisjoint) {
+ GLint disjoint_value = 0;
+ glGetIntegerv(GL_GPU_DISJOINT_EXT, &disjoint_value);
+ if (disjoint_value) {
+ disjoint_counter_++;
+ }
+ }
+ return disjoint_counter_;
+}
+
GPUTimer::~GPUTimer() {
glDeleteQueriesARB(2, queries_);
}
@@ -87,6 +98,7 @@
: gpu_timing_(gpu_timing) {
if (gpu_timing) {
timer_type_ = gpu_timing->GetTimerType();
+ disjoint_counter_ = gpu_timing_->GetDisjointCount();
}
}
@@ -111,12 +123,13 @@
bool GPUTimingClient::CheckAndResetTimerErrors() {
if (timer_type_ == GPUTiming::kTimerTypeDisjoint) {
- GLint disjoint_value = 0;
- glGetIntegerv(GL_GPU_DISJOINT_EXT, &disjoint_value);
- return disjoint_value != 0;
- } else {
- return false;
+ DCHECK(gpu_timing_ != nullptr);
+ const uint32_t total_disjoint_count = gpu_timing_->GetDisjointCount();
+ const bool disjoint_triggered = total_disjoint_count != disjoint_counter_;
+ disjoint_counter_ = total_disjoint_count;
+ return disjoint_triggered;
}
+ return false;
}
int64 GPUTimingClient::CalculateTimerOffset() {
diff --git a/ui/gl/gpu_timing.h b/ui/gl/gpu_timing.h
index 9702fe1..1c8f8cf 100644
--- a/ui/gl/gpu_timing.h
+++ b/ui/gl/gpu_timing.h
@@ -52,6 +52,7 @@
};
TimerType GetTimerType() const { return timer_type_; }
+ uint32_t GetDisjointCount();
private:
friend struct base::DefaultDeleter<GPUTiming>;
@@ -62,6 +63,7 @@
scoped_refptr<GPUTimingClient> CreateGPUTimingClient();
TimerType timer_type_ = kTimerTypeInvalid;
+ uint32_t disjoint_counter_ = 0;
DISALLOW_COPY_AND_ASSIGN(GPUTiming);
};
@@ -125,6 +127,7 @@
GPUTiming* gpu_timing_;
GPUTiming::TimerType timer_type_ = GPUTiming::kTimerTypeInvalid;
int64 offset_ = 0; // offset cache when timer_type_ == kTimerTypeARB
+ uint32_t disjoint_counter_ = 0;
bool offset_valid_ = false;
base::Callback<int64(void)> cpu_time_for_testing_;
diff --git a/ui/platform_window/x11/x11_window.h b/ui/platform_window/x11/x11_window.h
index 6e1184c..eb75912 100644
--- a/ui/platform_window/x11/x11_window.h
+++ b/ui/platform_window/x11/x11_window.h
@@ -21,7 +21,7 @@
public PlatformEventDispatcher {
public:
explicit X11Window(PlatformWindowDelegate* delegate);
- virtual ~X11Window();
+ ~X11Window() override;
private:
void Destroy();
@@ -29,23 +29,23 @@
void ProcessXInput2Event(XEvent* xevent);
// PlatformWindow:
- virtual void Show() override;
- virtual void Hide() override;
- virtual void Close() override;
- virtual void SetBounds(const gfx::Rect& bounds) override;
- virtual gfx::Rect GetBounds() override;
- virtual void SetCapture() override;
- virtual void ReleaseCapture() override;
- virtual void ToggleFullscreen() override;
- virtual void Maximize() override;
- virtual void Minimize() override;
- virtual void Restore() override;
- virtual void SetCursor(PlatformCursor cursor) override;
- virtual void MoveCursorTo(const gfx::Point& location) override;
+ void Show() override;
+ void Hide() override;
+ void Close() override;
+ void SetBounds(const gfx::Rect& bounds) override;
+ gfx::Rect GetBounds() override;
+ void SetCapture() override;
+ void ReleaseCapture() override;
+ void ToggleFullscreen() override;
+ void Maximize() override;
+ void Minimize() override;
+ void Restore() override;
+ void SetCursor(PlatformCursor cursor) override;
+ void MoveCursorTo(const gfx::Point& location) override;
// PlatformEventDispatcher:
- virtual bool CanDispatchEvent(const PlatformEvent& event) override;
- virtual uint32_t DispatchEvent(const PlatformEvent& event) override;
+ bool CanDispatchEvent(const PlatformEvent& event) override;
+ uint32_t DispatchEvent(const PlatformEvent& event) override;
PlatformWindowDelegate* delegate_;