diff options
author | Marco Nelissen <marcone@google.com> | 2014-11-14 08:01:01 -0800 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2014-11-17 08:47:01 -0800 |
commit | 097ca275f4717a2c47a5d49f302ed2b72c8a1370 (patch) | |
tree | 1c2f6c7b2fc2b71aab6759a0b1d8de22db46e830 /services/surfaceflinger | |
parent | d72ff140e0df44106cd8539396ce686aa8f3306a (diff) | |
download | frameworks_native-097ca275f4717a2c47a5d49f302ed2b72c8a1370.zip frameworks_native-097ca275f4717a2c47a5d49f302ed2b72c8a1370.tar.gz frameworks_native-097ca275f4717a2c47a5d49f302ed2b72c8a1370.tar.bz2 |
Replace IInterface::asBinder() with a static
so we can do NULL checks again, and update calls to IInterface::asBinder()
to use the new static version.
Change-Id: Ia7b10eb38ca55b72278bfd33d3bf647f338b4e6a
Diffstat (limited to 'services/surfaceflinger')
-rw-r--r-- | services/surfaceflinger/MonitoredProducer.cpp | 4 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 20 |
2 files changed, 11 insertions, 13 deletions
diff --git a/services/surfaceflinger/MonitoredProducer.cpp b/services/surfaceflinger/MonitoredProducer.cpp index 8739682..37a044e 100644 --- a/services/surfaceflinger/MonitoredProducer.cpp +++ b/services/surfaceflinger/MonitoredProducer.cpp @@ -49,7 +49,7 @@ MonitoredProducer::~MonitoredProducer() { wp<IBinder> mProducer; }; - mFlinger->postMessageAsync(new MessageCleanUpList(mFlinger, asBinder())); + mFlinger->postMessageAsync(new MessageCleanUpList(mFlinger, asBinder(this))); } status_t MonitoredProducer::requestBuffer(int slot, sp<GraphicBuffer>* buf) { @@ -111,7 +111,7 @@ void MonitoredProducer::allocateBuffers(bool async, uint32_t width, } IBinder* MonitoredProducer::onAsBinder() { - return mProducer->asBinder().get(); + return IInterface::asBinder(mProducer).get(); } // --------------------------------------------------------------------------- diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index e767be2..8daf0f9 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -496,7 +496,7 @@ size_t SurfaceFlinger::getMaxViewportDims() const { bool SurfaceFlinger::authenticateSurfaceTexture( const sp<IGraphicBufferProducer>& bufferProducer) const { Mutex::Autolock _l(mStateLock); - sp<IBinder> surfaceTextureBinder(bufferProducer->asBinder()); + sp<IBinder> surfaceTextureBinder(IInterface::asBinder(bufferProducer)); return mGraphicBufferProducerList.indexOf(surfaceTextureBinder) >= 0; } @@ -1273,10 +1273,8 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags) // this display is in both lists. see if something changed. const DisplayDeviceState& state(curr[j]); const wp<IBinder>& display(curr.keyAt(j)); - const sp<IBinder> state_binder = - state.surface != NULL ? state.surface->asBinder() : NULL; - const sp<IBinder> draw_binder = - draw[i].surface != NULL ? draw[i].surface->asBinder() : NULL; + const sp<IBinder> state_binder = IInterface::asBinder(state.surface); + const sp<IBinder> draw_binder = IInterface::asBinder(draw[i].surface); if (state_binder != draw_binder) { // changing the surface is like destroying and // recreating the DisplayDevice, so we just remove it @@ -1910,7 +1908,7 @@ void SurfaceFlinger::addClientLayer(const sp<Client>& client, // add this layer to the current state list Mutex::Autolock _l(mStateLock); mCurrentState.layersSortedByZ.add(lbc); - mGraphicBufferProducerList.add(gbc->asBinder()); + mGraphicBufferProducerList.add(IInterface::asBinder(gbc)); } status_t SurfaceFlinger::removeLayer(const sp<Layer>& layer) { @@ -1983,7 +1981,7 @@ void SurfaceFlinger::setTransactionState( // NOTE: it would be better to use RTTI as we could directly check // that we have a Client*. however, RTTI is disabled in Android. if (s.client != NULL) { - sp<IBinder> binder = s.client->asBinder(); + sp<IBinder> binder = IInterface::asBinder(s.client); if (binder != NULL) { String16 desc(binder->getInterfaceDescriptor()); if (desc == ISurfaceComposerClient::descriptor) { @@ -2030,7 +2028,7 @@ uint32_t SurfaceFlinger::setDisplayStateLocked(const DisplayState& s) if (disp.isValid()) { const uint32_t what = s.what; if (what & DisplayState::eSurfaceChanged) { - if (disp.surface->asBinder() != s.surface->asBinder()) { + if (IInterface::asBinder(disp.surface) != IInterface::asBinder(s.surface)) { disp.surface = s.surface; flags |= eDisplayTransactionNeeded; } @@ -2921,7 +2919,7 @@ class GraphicProducerWrapper : public BBinder, public MessageHandler { // Prevent reads below from happening before the read from Message atomic_thread_fence(memory_order_acquire); if (what == MSG_API_CALL) { - result = impl->asBinder()->transact(code, data[0], reply); + result = IInterface::asBinder(impl)->transact(code, data[0], reply); barrier.open(); } else if (what == MSG_EXIT) { exitRequested = true; @@ -2971,7 +2969,7 @@ status_t SurfaceFlinger::captureScreen(const sp<IBinder>& display, // if we have secure windows on this display, never allow the screen capture // unless the producer interface is local (i.e.: we can take a screenshot for // ourselves). - if (!producer->asBinder()->localBinder()) { + if (!IInterface::asBinder(producer)->localBinder()) { Mutex::Autolock _l(mStateLock); sp<const DisplayDevice> hw(getDisplayDevice(display)); if (hw->getSecureLayerVisible()) { @@ -3035,7 +3033,7 @@ status_t SurfaceFlinger::captureScreen(const sp<IBinder>& display, result = flinger->captureScreenImplLocked(hw, producer, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, rotation); - static_cast<GraphicProducerWrapper*>(producer->asBinder().get())->exit(result); + static_cast<GraphicProducerWrapper*>(IInterface::asBinder(producer).get())->exit(result); return true; } }; |