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

Side by Side Diff: src/platform-macos.cc

Issue 40104: Removed function SendAll from Socket (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/platform-linux.cc ('k') | src/platform-win32.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 // Server initialization. 600 // Server initialization.
601 bool Bind(const int port); 601 bool Bind(const int port);
602 bool Listen(int backlog) const; 602 bool Listen(int backlog) const;
603 Socket* Accept() const; 603 Socket* Accept() const;
604 604
605 // Client initialization. 605 // Client initialization.
606 bool Connect(const char* host, const char* port); 606 bool Connect(const char* host, const char* port);
607 607
608 // Data Transimission 608 // Data Transimission
609 int Send(const char* data, int len) const; 609 int Send(const char* data, int len) const;
610 bool SendAll(const char* data, int len) const;
611 int Receive(char* data, int len) const; 610 int Receive(char* data, int len) const;
612 611
613 bool IsValid() const { return socket_ != -1; } 612 bool IsValid() const { return socket_ != -1; }
614 613
615 private: 614 private:
616 int socket_; 615 int socket_;
617 }; 616 };
618 617
619 618
620 bool MacOSSocket::Bind(const int port) { 619 bool MacOSSocket::Bind(const int port) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 return status == 0; 685 return status == 0;
687 } 686 }
688 687
689 688
690 int MacOSSocket::Send(const char* data, int len) const { 689 int MacOSSocket::Send(const char* data, int len) const {
691 int status = send(socket_, data, len, 0); 690 int status = send(socket_, data, len, 0);
692 return status; 691 return status;
693 } 692 }
694 693
695 694
696 bool MacOSSocket::SendAll(const char* data, int len) const {
697 int sent_len = 0;
698 while (sent_len < len) {
699 int status = Send(data, len);
700 if (status <= 0) {
701 return false;
702 }
703 sent_len += status;
704 }
705 return true;
706 }
707
708
709 int MacOSSocket::Receive(char* data, int len) const { 695 int MacOSSocket::Receive(char* data, int len) const {
710 int status = recv(socket_, data, len, 0); 696 int status = recv(socket_, data, len, 0);
711 return status; 697 return status;
712 } 698 }
713 699
714 700
715 bool Socket::Setup() { 701 bool Socket::Setup() {
716 // Nothing to do on MacOS. 702 // Nothing to do on MacOS.
717 return true; 703 return true;
718 } 704 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 } 827 }
842 828
843 // This sampler is no longer the active sampler. 829 // This sampler is no longer the active sampler.
844 active_sampler_ = NULL; 830 active_sampler_ = NULL;
845 active_ = false; 831 active_ = false;
846 } 832 }
847 833
848 #endif // ENABLE_LOGGING_AND_PROFILING 834 #endif // ENABLE_LOGGING_AND_PROFILING
849 835
850 } } // namespace v8::internal 836 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-linux.cc ('k') | src/platform-win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698