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

Side by Side Diff: components/view_manager/surfaces/surfaces_context_provider.cc

Issue 1317743002: cc: Implement shared worker contexts. (v1) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: surfaces_context_provider fix Created 5 years, 3 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
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 "components/view_manager/surfaces/surfaces_context_provider.h" 5 #include "components/view_manager/surfaces/surfaces_context_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "components/view_manager/gles2/command_buffer_driver.h" 10 #include "components/view_manager/gles2/command_buffer_driver.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 bool SurfacesContextProvider::DestroyedOnMainThread() { 103 bool SurfacesContextProvider::DestroyedOnMainThread() {
104 return !command_buffer_local_; 104 return !command_buffer_local_;
105 } 105 }
106 106
107 void SurfacesContextProvider::SetLostContextCallback( 107 void SurfacesContextProvider::SetLostContextCallback(
108 const LostContextCallback& lost_context_callback) { 108 const LostContextCallback& lost_context_callback) {
109 lost_context_callback_ = lost_context_callback; 109 lost_context_callback_ = lost_context_callback;
110 } 110 }
111 111
112 bool SurfaceContextProvider::HasBeenDestroyed() {
113 return !command_buffer_local_;
114 }
115
112 SurfacesContextProvider::~SurfacesContextProvider() { 116 SurfacesContextProvider::~SurfacesContextProvider() {
113 implementation_->Flush(); 117 implementation_->Flush();
114 implementation_.reset(); 118 implementation_.reset();
115 transfer_buffer_.reset(); 119 transfer_buffer_.reset();
116 gles2_helper_.reset(); 120 gles2_helper_.reset();
117 command_buffer_local_.reset(); 121 command_buffer_local_.reset();
118 } 122 }
119 123
120 void SurfacesContextProvider::UpdateVSyncParameters(int64_t timebase, 124 void SurfacesContextProvider::UpdateVSyncParameters(int64_t timebase,
121 int64_t interval) { 125 int64_t interval) {
122 if (delegate_) 126 if (delegate_)
123 delegate_->OnVSyncParametersUpdated(timebase, interval); 127 delegate_->OnVSyncParametersUpdated(timebase, interval);
124 } 128 }
125 129
126 void SurfacesContextProvider::DidLoseContext() { 130 void SurfacesContextProvider::DidLoseContext() {
127 lost_context_callback_.Run(); 131 lost_context_callback_.Run();
128 } 132 }
129 133
130 } // namespace surfaces 134 } // namespace surfaces
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698